gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: -fix assertion failure caused by


From: gnunet
Subject: [taler-exchange] branch master updated: -fix assertion failure caused by testcase
Date: Fri, 06 Aug 2021 10:21:00 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new caf68078 -fix assertion failure caused by testcase
caf68078 is described below

commit caf6807856e3044f7e1065d84ca189e4d89b3b12
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Aug 6 10:20:58 2021 +0200

    -fix assertion failure caused by testcase
---
 src/exchange/taler-exchange-httpd_keys.c     | 10 ++++++++++
 src/exchangedb/plugin_exchangedb_postgres.c  |  8 ++++++++
 src/testing/testing_api_cmd_insert_deposit.c | 23 +++++++++++++++++++++--
 3 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/src/exchange/taler-exchange-httpd_keys.c 
b/src/exchange/taler-exchange-httpd_keys.c
index da636d34..4af28b14 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -980,6 +980,16 @@ denomination_info_cb (
   struct TEH_KeyStateHandle *ksh = cls;
   struct TEH_DenominationKey *dk;
 
+  if ( (0 == meta->start.abs_value_us) ||
+       (0 == meta->expire_withdraw.abs_value_us) ||
+       (0 == meta->expire_deposit.abs_value_us) ||
+       (0 == meta->expire_legal.abs_value_us) )
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Database contains invalid denomination key %s\n",
+                GNUNET_h2s (h_denom_pub));
+    return;
+  }
   dk = GNUNET_new (struct TEH_DenominationKey);
   dk->denom_pub.rsa_public_key
     = GNUNET_CRYPTO_rsa_public_key_dup (denom_pub->rsa_public_key);
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index d0330d78..f589b92f 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -2753,6 +2753,14 @@ postgres_insert_denomination_info (
   };
 
   (void) cls;
+  GNUNET_assert (0 != GNUNET_TIME_absolute_ntoh (
+                   issue->properties.start).abs_value_us);
+  GNUNET_assert (0 != GNUNET_TIME_absolute_ntoh (
+                   issue->properties.expire_withdraw).abs_value_us);
+  GNUNET_assert (0 != GNUNET_TIME_absolute_ntoh (
+                   issue->properties.expire_deposit).abs_value_us);
+  GNUNET_assert (0 != GNUNET_TIME_absolute_ntoh (
+                   issue->properties.expire_legal).abs_value_us);
   /* check fees match coin currency */
   GNUNET_assert (GNUNET_YES ==
                  TALER_amount_cmp_currency_nbo (&issue->properties.value,
diff --git a/src/testing/testing_api_cmd_insert_deposit.c 
b/src/testing/testing_api_cmd_insert_deposit.c
index 607baeef..b614702a 100644
--- a/src/testing/testing_api_cmd_insert_deposit.c
+++ b/src/testing/testing_api_cmd_insert_deposit.c
@@ -81,8 +81,27 @@ struct InsertDepositState
 static void
 fake_issue (struct TALER_EXCHANGEDB_DenominationKeyInformationP *issue)
 {
-  memset (issue, 0, sizeof (struct
-                            TALER_EXCHANGEDB_DenominationKeyInformationP));
+  struct GNUNET_TIME_Absolute now;
+
+  memset (issue,
+          0,
+          sizeof (struct TALER_EXCHANGEDB_DenominationKeyInformationP));
+  now = GNUNET_TIME_absolute_get ();
+  (void) GNUNET_TIME_round_abs (&now);
+  issue->properties.start
+    = GNUNET_TIME_absolute_hton (now);
+  issue->properties.expire_withdraw
+    = GNUNET_TIME_absolute_hton (
+        GNUNET_TIME_absolute_add (now,
+                                  GNUNET_TIME_UNIT_MINUTES));
+  issue->properties.expire_deposit
+    = GNUNET_TIME_absolute_hton (
+        GNUNET_TIME_absolute_add (now,
+                                  GNUNET_TIME_UNIT_HOURS));
+  issue->properties.expire_legal
+    = GNUNET_TIME_absolute_hton (
+        GNUNET_TIME_absolute_add (now,
+                                  GNUNET_TIME_UNIT_DAYS));
   GNUNET_assert (GNUNET_OK ==
                  TALER_string_to_amount_nbo ("EUR:1",
                                              &issue->properties.value));

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]