gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] 57/130: DB test passes again


From: gnunet
Subject: [taler-exchange] 57/130: DB test passes again
Date: Wed, 17 Nov 2021 12:25:05 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

commit de8e0907aadecf4f97c0eb8230217751f3fd44a1
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Oct 31 15:32:20 2021 +0100

    DB test passes again
---
 src/exchangedb/exchange-0001.sql            |  2 +-
 src/exchangedb/plugin_exchangedb_postgres.c | 35 ++++++++++++++---------------
 src/exchangedb/test_exchangedb.c            | 21 +++++++++--------
 src/include/taler_exchangedb_plugin.h       |  4 ++--
 4 files changed, 30 insertions(+), 32 deletions(-)

diff --git a/src/exchangedb/exchange-0001.sql b/src/exchangedb/exchange-0001.sql
index 6de2af74..87ac555b 100644
--- a/src/exchangedb/exchange-0001.sql
+++ b/src/exchangedb/exchange-0001.sql
@@ -380,7 +380,7 @@ CREATE TABLE IF NOT EXISTS deposits
   ,tiny BOOLEAN NOT NULL DEFAULT FALSE
   ,done BOOLEAN NOT NULL DEFAULT FALSE
   ,extension_blocked BOOLEAN NOT NULL DEFAULT FALSE
-  ,extension_options VARCHAR NOT NULL
+  ,extension_options VARCHAR
   ,UNIQUE (known_coin_id, merchant_pub, h_contract_terms)
   );
 COMMENT ON TABLE deposits
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index ed63be87..017145e6 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -3904,7 +3904,7 @@ inselect_account_kyc_status (
     };
     uint8_t ok8 = 0;
     struct GNUNET_PQ_ResultSpec rs[] = {
-      GNUNET_PQ_result_spec_uint64 ("payment_target_uuid",
+      GNUNET_PQ_result_spec_uint64 ("wire_target_serial_id",
                                     &kyc->payment_target_uuid),
       GNUNET_PQ_result_spec_auto_from_type ("kyc_ok",
                                             &ok8),
@@ -5257,8 +5257,8 @@ postgres_mark_deposit_done (void *cls,
  */
 static enum GNUNET_DB_QueryStatus
 postgres_get_ready_deposit (void *cls,
-                            uint32_t start_shard_row,
-                            uint32_t end_shard_row,
+                            uint64_t start_shard_row,
+                            uint64_t end_shard_row,
                             TALER_EXCHANGEDB_DepositIterator deposit_cb,
                             void *deposit_cb_cls)
 {
@@ -5266,8 +5266,8 @@ postgres_get_ready_deposit (void *cls,
   struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
   struct GNUNET_PQ_QueryParam params[] = {
     TALER_PQ_query_param_absolute_time (&now),
-    GNUNET_PQ_query_param_uint32 (&start_shard_row),
-    GNUNET_PQ_query_param_uint32 (&end_shard_row),
+    GNUNET_PQ_query_param_uint64 (&start_shard_row),
+    GNUNET_PQ_query_param_uint64 (&end_shard_row),
     GNUNET_PQ_query_param_end
   };
   struct TALER_Amount amount_with_fee;
@@ -5301,7 +5301,7 @@ postgres_get_ready_deposit (void *cls,
 
   (void) GNUNET_TIME_round_abs (&now);
   GNUNET_assert (start_shard_row < end_shard_row);
-  GNUNET_assert (end_shard_row <= INT32_MAX);
+  GNUNET_assert (end_shard_row <= INT64_MAX);
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Finding ready deposits by deadline %s (%llu)\n",
               GNUNET_STRINGS_absolute_time_to_string (now),
@@ -5706,27 +5706,25 @@ postgres_ensure_coin_known (void *cls,
  * @param deposit deposit to compute shard for
  * @return shard number
  */
-static uint32_t
+static uint64_t
 compute_shard (const struct TALER_EXCHANGEDB_Deposit *deposit)
 {
-  uint32_t res;
+  uint64_t res;
 
   GNUNET_assert (GNUNET_YES ==
                  GNUNET_CRYPTO_kdf (&res,
                                     sizeof (res),
-                                    &deposit->wire_salt,
-                                    sizeof (deposit->wire_salt),
                                     &deposit->merchant_pub,
                                     sizeof (deposit->merchant_pub),
                                     deposit->receiver_wire_account,
                                     strlen (deposit->receiver_wire_account),
                                     NULL, 0));
   /* interpret hash result as NBO for platform independence,
-     convert to HBO and map to [0..2^31-1] range */
+     convert to HBO and map to [0..2^63-1] range */
   res = ntohl (res);
-  if (res > INT32_MAX)
-    res += INT32_MIN;
-  GNUNET_assert (res <= INT32_MAX);
+  if (res > INT64_MAX)
+    res += INT64_MIN;
+  GNUNET_assert (res <= INT64_MAX);
   return res;
 }
 
@@ -5758,7 +5756,7 @@ postgres_insert_deposit (void *cls,
     return qs;
   }
   {
-    uint32_t shard = compute_shard (deposit);
+    uint64_t shard = compute_shard (deposit);
     struct GNUNET_PQ_QueryParam params[] = {
       GNUNET_PQ_query_param_auto_from_type (&deposit->coin.coin_pub),
       TALER_PQ_query_param_amount (&deposit->amount_with_fee),
@@ -5771,11 +5769,11 @@ postgres_insert_deposit (void *cls,
       GNUNET_PQ_query_param_uint64 (&kyc.payment_target_uuid),
       GNUNET_PQ_query_param_auto_from_type (&deposit->csig),
       TALER_PQ_query_param_absolute_time (&exchange_timestamp),
-      GNUNET_PQ_query_param_uint32 (&shard),
+      GNUNET_PQ_query_param_uint64 (&shard),
       GNUNET_PQ_query_param_end
     };
 
-    GNUNET_assert (shard <= INT32_MAX);
+    GNUNET_assert (shard <= INT64_MAX);
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                 "Inserting deposit to be executed at %s (%llu/%llu)\n",
                 GNUNET_STRINGS_absolute_time_to_string 
(deposit->wire_deadline),
@@ -7274,6 +7272,7 @@ postgres_lookup_transfer_by_deposit (
       kyc->ok = true;
       return qs;
     }
+    qs = GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
   }
   if (0 > qs)
     return qs;
@@ -11361,7 +11360,7 @@ postgres_begin_revolving_shard (void *cls,
 {
   struct PostgresClosure *pg = cls;
 
-  GNUNET_assert (shard_limit <= 1U + (uint32_t) INT32_MAX);
+  GNUNET_assert (shard_limit <= 1U + (uint32_t) INT_MAX);
   GNUNET_assert (shard_limit > 0);
   GNUNET_assert (shard_size > 0);
   for (unsigned int retries = 0; retries<3; retries++)
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 4dd762fa..817dcbbc 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -1472,7 +1472,6 @@ run (void *cls)
   enum GNUNET_DB_QueryStatus qs;
   struct GNUNET_TIME_Absolute now;
   struct TALER_WireSalt salt;
-  struct TALER_MerchantWireHash h_wire;
 
   dkp = NULL;
   rh = NULL;
@@ -1803,7 +1802,7 @@ run (void *cls)
   TALER_merchant_wire_signature_hash (
     "payto://iban/DE67830654080004822650?receiver-name=Test",
     &deposit.wire_salt,
-    &h_wire);
+    &h_wire_wt);
   deposit.amount_with_fee = value;
   deposit.deposit_fee = fee_deposit;
 
@@ -1855,6 +1854,13 @@ run (void *cls)
                                                    NULL));
   FAILIF (1 != auditor_row_cnt);
   result = 9;
+  sleep (2); /* give deposit time to be ready */
+  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
+          plugin->get_ready_deposit (plugin->cls,
+                                     0,
+                                     INT64_MAX,
+                                     &deposit_cb,
+                                     &deposit));
   FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->iterate_matching_deposits (plugin->cls,
                                              wire_target_row,
@@ -1862,13 +1868,6 @@ run (void *cls)
                                              &matching_deposit_cb,
                                              &deposit,
                                              2));
-  sleep (2); /* give deposit time to be ready */
-  FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
-          plugin->get_ready_deposit (plugin->cls,
-                                     0,
-                                     INT32_MAX,
-                                     &deposit_cb,
-                                     &deposit));
   FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
           plugin->commit (plugin->cls));
   FAILIF (GNUNET_OK !=
@@ -1880,14 +1879,14 @@ run (void *cls)
   FAILIF (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS !=
           plugin->get_ready_deposit (plugin->cls,
                                      0,
-                                     INT32_MAX,
+                                     INT64_MAX,
                                      &deposit_cb,
                                      &deposit));
   plugin->rollback (plugin->cls);
   FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->get_ready_deposit (plugin->cls,
                                      0,
-                                     INT32_MAX,
+                                     INT64_MAX,
                                      &deposit_cb,
                                      &deposit));
   FAILIF (GNUNET_OK !=
diff --git a/src/include/taler_exchangedb_plugin.h 
b/src/include/taler_exchangedb_plugin.h
index 1355615c..aa67092e 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -2742,8 +2742,8 @@ struct TALER_EXCHANGEDB_Plugin
    */
   enum GNUNET_DB_QueryStatus
   (*get_ready_deposit)(void *cls,
-                       uint32_t start_shard_row,
-                       uint32_t end_shard_row,
+                       uint64_t start_shard_row,
+                       uint64_t end_shard_row,
                        TALER_EXCHANGEDB_DepositIterator deposit_cb,
                        void *deposit_cb_cls);
 

-- 
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]