gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -more json_pack fixes


From: gnunet
Subject: [taler-exchange] branch master updated: -more json_pack fixes
Date: Sat, 31 Jul 2021 21:48:39 +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 33a28efe -more json_pack fixes
33a28efe is described below

commit 33a28efef74d1db0c08a8e9e3facf3656b4b29e1
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Jul 31 21:48:36 2021 +0200

    -more json_pack fixes
---
 src/auditor/taler-helper-auditor-aggregation.c | 10 +--
 src/auditor/taler-helper-auditor-coins.c       |  4 +-
 src/auditor/taler-helper-auditor-deposits.c    | 14 ++--
 src/auditor/taler-helper-auditor-reserves.c    |  6 +-
 src/exchangedb/Makefile.am                     |  5 +-
 src/exchangedb/test_exchangedb.c               | 17 +++--
 src/testing/testing_api_cmd_insert_deposit.c   |  8 ++-
 src/testing/testing_api_helpers_bank.c         | 88 ++------------------------
 8 files changed, 41 insertions(+), 111 deletions(-)

diff --git a/src/auditor/taler-helper-auditor-aggregation.c 
b/src/auditor/taler-helper-auditor-aggregation.c
index 4990ae40..c6398be2 100644
--- a/src/auditor/taler-helper-auditor-aggregation.c
+++ b/src/auditor/taler-helper-auditor-aggregation.c
@@ -127,7 +127,7 @@ static int internal_checks;
  * respect to calculations involving amounts.
  *
  * @param operation what operation had the inconsistency
- * @param rowid affected row, UINT64_MAX if row is missing
+ * @param rowid affected row, 0 if row is missing
  * @param exchange amount calculated by exchange
  * @param auditor amount calculated by auditor
  * @param profitable 1 if @a exchange being larger than @a auditor is
@@ -254,7 +254,7 @@ report_coin_arithmetic_inconsistency (
  * Report a (serious) inconsistency in the exchange's database.
  *
  * @param table affected table
- * @param rowid affected row, UINT64_MAX if row is missing
+ * @param rowid affected row, 0 if row is missing
  * @param diagnostic message explaining the problem
  */
 static void
@@ -499,7 +499,7 @@ check_transaction_history_for_deposit (
         {
           /* Disagreement in fee structure between auditor and exchange DB! */
           report_amount_arithmetic_inconsistency ("deposit fee",
-                                                  UINT64_MAX,
+                                                  0,
                                                   fee_claimed,
                                                   &fee_expected,
                                                   1);
@@ -524,7 +524,7 @@ check_transaction_history_for_deposit (
         {
           /* Disagreement in fee structure between exchange and auditor */
           report_amount_arithmetic_inconsistency ("melt fee",
-                                                  UINT64_MAX,
+                                                  0,
                                                   fee_claimed,
                                                   &fee_expected,
                                                   1);
@@ -568,7 +568,7 @@ check_transaction_history_for_deposit (
         {
           /* Disagreement in fee structure between exchange and auditor! */
           report_amount_arithmetic_inconsistency ("refund fee",
-                                                  UINT64_MAX,
+                                                  0,
                                                   fee_claimed,
                                                   &fee_expected,
                                                   1);
diff --git a/src/auditor/taler-helper-auditor-coins.c 
b/src/auditor/taler-helper-auditor-coins.c
index 40b68c4a..b3050542 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -364,7 +364,7 @@ report_emergency_by_count (
  * respect to calculations involving amounts.
  *
  * @param operation what operation had the inconsistency
- * @param rowid affected row, UINT64_MAX if row is missing
+ * @param rowid affected row, 0 if row is missing
  * @param exchange amount calculated by exchange
  * @param auditor amount calculated by auditor
  * @param profitable 1 if @a exchange being larger than @a auditor is
@@ -429,7 +429,7 @@ report_amount_arithmetic_inconsistency (
  * Report a (serious) inconsistency in the exchange's database.
  *
  * @param table affected table
- * @param rowid affected row, UINT64_MAX if row is missing
+ * @param rowid affected row, 0 if row is missing
  * @param diagnostic message explaining the problem
  */
 static void
diff --git a/src/auditor/taler-helper-auditor-deposits.c 
b/src/auditor/taler-helper-auditor-deposits.c
index 17b32f25..c9c8bf66 100644
--- a/src/auditor/taler-helper-auditor-deposits.c
+++ b/src/auditor/taler-helper-auditor-deposits.c
@@ -216,13 +216,13 @@ analyze_deposit_confirmations (void *cls)
   dcc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
   dcc.missed_count = 0LLU;
   dcc.first_missed_coin_serial = UINT64_MAX;
-  qsx = TALER_ARL_adb->get_deposit_confirmations (TALER_ARL_adb->cls,
-                                                  TALER_ARL_asession,
-                                                  &TALER_ARL_master_pub,
-                                                  ppdc.
-                                                  
last_deposit_confirmation_serial_id,
-                                                  &test_dc,
-                                                  &dcc);
+  qsx = TALER_ARL_adb->get_deposit_confirmations (
+    TALER_ARL_adb->cls,
+    TALER_ARL_asession,
+    &TALER_ARL_master_pub,
+    ppdc.last_deposit_confirmation_serial_id,
+    &test_dc,
+    &dcc);
   if (0 > qsx)
   {
     GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qsx);
diff --git a/src/auditor/taler-helper-auditor-reserves.c 
b/src/auditor/taler-helper-auditor-reserves.c
index 22d7f5c2..efeaa4f6 100644
--- a/src/auditor/taler-helper-auditor-reserves.c
+++ b/src/auditor/taler-helper-auditor-reserves.c
@@ -155,7 +155,7 @@ static int internal_checks;
  * respect to calculations involving amounts.
  *
  * @param operation what operation had the inconsistency
- * @param rowid affected row, UINT64_MAX if row is missing
+ * @param rowid affected row, 0 if row is missing
  * @param exchange amount calculated by exchange
  * @param auditor amount calculated by auditor
  * @param profitable 1 if @a exchange being larger than @a auditor is
@@ -218,7 +218,7 @@ report_amount_arithmetic_inconsistency (
  * Report a (serious) inconsistency in the exchange's database.
  *
  * @param table affected table
- * @param rowid affected row, UINT64_MAX if row is missing
+ * @param rowid affected row, 0 if row is missing
  * @param diagnostic message explaining the problem
  */
 static void
@@ -1231,7 +1231,7 @@ verify_reserve_balance (void *cls,
          to be withdrawn more than it was IN TOTAL ever given (exchange balance
          went negative!).  Woopsie. Calculate how badly it went and log. */
       report_amount_arithmetic_inconsistency ("global escrow balance",
-                                              UINT64_MAX,
+                                              0,
                                               &total_escrow_balance, /* what 
we had */
                                               &rs->total_out, /* what we 
needed */
                                               0 /* specific profit/loss does 
not apply to the total summary */);
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am
index 26f5a3cb..5114fb9c 100644
--- a/src/exchangedb/Makefile.am
+++ b/src/exchangedb/Makefile.am
@@ -83,9 +83,10 @@ test_exchangedb_postgres_SOURCES = \
 test_exchangedb_postgres_LDADD = \
   libtalerexchangedb.la \
   $(top_builddir)/src/json/libtalerjson.la \
-  $(top_srcdir)/src/util/libtalerutil.la \
-  $(top_srcdir)/src/pq/libtalerpq.la \
+  $(top_builddir)/src/util/libtalerutil.la \
+  $(top_builddir)/src/pq/libtalerpq.la \
   -ljansson \
+  -lgnunetjson \
   -lgnunetutil \
   $(XLIB)
 
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 46213427..fd11de2e 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -1348,10 +1348,11 @@ test_wire_out (struct TALER_EXCHANGEDB_Session *session,
   {
     json_t *wire_out_account;
 
-    wire_out_account = json_pack ("{s:s,s:s}",
-                                  "payto_uri",
-                                  "payto://x-taler-bank/localhost:8080/1",
-                                  "salt", "this-is-my-salt");
+    wire_out_account = GNUNET_JSON_PACK (
+      GNUNET_JSON_pack_string ("payto_uri",
+                               "payto://x-taler-bank/localhost:8080/1"),
+      GNUNET_JSON_pack_string ("salt",
+                               "this-is-my-salt"));
     if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
         plugin->store_wire_transfer_out (plugin->cls,
                                          session,
@@ -1567,9 +1568,11 @@ run (void *cls)
   rh = NULL;
   session = NULL;
   deposit.coin.denom_sig.rsa_signature = NULL;
-  wire = json_pack ("{s:s, s:s}",
-                    "payto_uri", "payto://sepa/DE67830654080004822650",
-                    "salt", "this-is-a-salt-value");
+  wire = GNUNET_JSON_PACK (
+    GNUNET_JSON_pack_string ("payto_uri",
+                             "payto://sepa/DE67830654080004822650"),
+    GNUNET_JSON_pack_string ("salt",
+                             "this-is-a-salt-value"));
   ZR_BLK (&cbc);
   ZR_BLK (&cbc2);
   if (NULL ==
diff --git a/src/testing/testing_api_cmd_insert_deposit.c 
b/src/testing/testing_api_cmd_insert_deposit.c
index 06f2dbe0..607baeef 100644
--- a/src/testing/testing_api_cmd_insert_deposit.c
+++ b/src/testing/testing_api_cmd_insert_deposit.c
@@ -189,9 +189,11 @@ insert_deposit_run (void *cls,
                      "payto://x-taler-bank/localhost/%s",
                      ids->merchant_account);
     deposit.receiver_wire_account
-      = json_pack ("{s:s, s:s}",
-                   "salt", "this-is-a-salt-value",
-                   "payto_uri", str);
+      = GNUNET_JSON_PACK (
+          GNUNET_JSON_pack_string ("salt",
+                                   "this-is-a-salt-value"),
+          GNUNET_JSON_pack_string ("payto_uri",
+                                   str));
     GNUNET_free (str);
   }
 
diff --git a/src/testing/testing_api_helpers_bank.c 
b/src/testing/testing_api_helpers_bank.c
index 6751f3f4..a82bcbfe 100644
--- a/src/testing/testing_api_helpers_bank.c
+++ b/src/testing/testing_api_helpers_bank.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2018-2020 Taler Systems SA
+  Copyright (C) 2018-2021 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as
@@ -31,15 +31,6 @@
   do {GNUNET_break (0); return NULL; } while (0)
 
 
-/**
- * Runs the Fakebank by guessing / extracting the portnumber
- * from the base URL.
- *
- * @param bank_url bank's base URL.
- * @param currency currency the bank uses
- * @return the fakebank process handle, or NULL if any
- *         error occurs.
- */
 struct TALER_FAKEBANK_Handle *
 TALER_TESTING_run_fakebank (const char *bank_url,
                             const char *currency)
@@ -69,13 +60,6 @@ TALER_TESTING_run_fakebank (const char *bank_url,
 }
 
 
-/**
- * Look for substring in a programs' name.
- *
- * @param prog program's name to look into
- * @param marker chunk to find in @a prog
- * @return #GNUNET_YES if @a marker is present, otherwise #GNUNET_NO
- */
 int
 TALER_TESTING_has_in_name (const char *prog,
                            const char *marker)
@@ -100,16 +84,6 @@ TALER_TESTING_has_in_name (const char *prog,
 }
 
 
-/**
- * Start the (nexus) bank process.  Assume the port
- * is available and the database is clean.  Use the "prepare
- * bank" function to do such tasks.  This function is also
- * responsible to create the exchange user at Nexus.
- *
- * @param bc bank configuration of the bank
- * @return the pair of both service handles.  In case of
- *         errors, each element of the pair will be set to NULL.
- */
 struct TALER_TESTING_LibeufinServices
 TALER_TESTING_run_libeufin (const struct TALER_TESTING_BankConfiguration *bc)
 {
@@ -224,17 +198,6 @@ TALER_TESTING_run_libeufin (const struct 
TALER_TESTING_BankConfiguration *bc)
 }
 
 
-/**
- * Start the (Python) bank process.  Assume the port
- * is available and the database is clean.  Use the "prepare
- * bank" function to do such tasks.
- *
- * @param config_filename configuration filename.
- * @param bank_url base URL of the bank, used by `wget' to check
- *        that the bank was started right.
- * @return the process, or NULL if the process could not
- *         be started.
- */
 struct GNUNET_OS_Process *
 TALER_TESTING_run_bank (const char *config_filename,
                         const char *bank_url)
@@ -318,17 +281,6 @@ TALER_TESTING_run_bank (const char *config_filename,
 }
 
 
-/**
- * Prepare the Nexus execution.  Check if the port is available
- * and delete old database.
- *
- * @param config_filename configuration file name.
- * @param reset_db should we reset the bank's database
- * @param config_section section of the configuration with the exchange's 
account
- * @param[out] bc set to the bank's configuration data
- * @return the base url, or NULL upon errors.  Must be freed
- *         by the caller.
- */
 int
 TALER_TESTING_prepare_nexus (const char *config_filename,
                              int reset_db,
@@ -434,17 +386,6 @@ TALER_TESTING_prepare_nexus (const char *config_filename,
 }
 
 
-/**
- * Prepare the bank execution.  Check if the port is available
- * and reset database.
- *
- * @param config_filename configuration file name.
- * @param reset_db should we reset the bank's database
- * @param config_section section of the configuration with the exchange's 
account
- * @param[out] bc set to the bank's configuration data
- * @return the base url, or NULL upon errors.  Must be freed
- *         by the caller.
- */
 int
 TALER_TESTING_prepare_bank (const char *config_filename,
                             int reset_db,
@@ -611,16 +552,6 @@ TALER_TESTING_prepare_bank (const char *config_filename,
 }
 
 
-/**
- * Prepare launching a fakebank.  Check that the configuration
- * file has the right option, and that the port is available.
- * If everything is OK, return the configuration data of the fakebank.
- *
- * @param config_filename configuration file to use
- * @param config_section which account to use (must match x-taler-bank)
- * @param[out] bc set to the bank's configuration data
- * @return #GNUNET_OK on success
- */
 int
 TALER_TESTING_prepare_fakebank (const char *config_filename,
                                 const char *config_section,
@@ -706,21 +637,14 @@ TALER_TESTING_prepare_fakebank (const char 
*config_filename,
 }
 
 
-/**
- * Allocate and return a piece of wire-details.  Combines
- * a @a payto -URL and adds some salt to create the JSON.
- *
- * @param payto payto://-URL to encapsulate
- * @return JSON describing the account, including the
- *         payto://-URL of the account, must be manually decref'd
- */
 json_t *
 TALER_TESTING_make_wire_details (const char *payto)
 {
-  return json_pack ("{s:s, s:s}",
-                    "payto_uri", payto,
-                    "salt",
-                    "test-salt (must be constant for aggregation tests)");
+  return GNUNET_JSON_PACK (
+    GNUNET_JSON_pack_string ("payto_uri",
+                             payto),
+    GNUNET_JSON_pack_string ("salt",
+                             "test-salt (must be constant for aggregation 
tests)"));
 }
 
 

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