gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] 02/02: work on auditor-sync update to latest DB


From: gnunet
Subject: [taler-exchange] 02/02: work on auditor-sync update to latest DB
Date: Mon, 28 Feb 2022 22:41:29 +0100

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

grothoff pushed a commit to branch master
in repository exchange.

commit 3d4e580699107fcd8d5df0fa02c097de5d168694
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Feb 28 22:41:21 2022 +0100

    work on auditor-sync update to latest DB
---
 src/exchangedb/irbt_callbacks.c             | 14 ++++++--------
 src/exchangedb/lrbt_callbacks.c             |  4 ++++
 src/exchangedb/plugin_exchangedb_postgres.c |  8 ++++++--
 src/include/taler_exchangedb_plugin.h       |  1 +
 4 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/exchangedb/irbt_callbacks.c b/src/exchangedb/irbt_callbacks.c
index 821ebac8..44acaf8a 100644
--- a/src/exchangedb/irbt_callbacks.c
+++ b/src/exchangedb/irbt_callbacks.c
@@ -264,13 +264,12 @@ static enum GNUNET_DB_QueryStatus
 irbt_cb_table_auditors (struct PostgresClosure *pg,
                         const struct TALER_EXCHANGEDB_TableData *td)
 {
-  uint8_t is_active = td->details.auditors.is_active ? 1 : 0;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_uint64 (&td->serial),
     GNUNET_PQ_query_param_auto_from_type (&td->details.auditors.auditor_pub),
     GNUNET_PQ_query_param_string (td->details.auditors.auditor_name),
     GNUNET_PQ_query_param_string (td->details.auditors.auditor_url),
-    GNUNET_PQ_query_param_auto_from_type (&is_active),
+    GNUNET_PQ_query_param_bool (&td->details.auditors.is_active),
     GNUNET_PQ_query_param_timestamp (&td->details.auditors.last_change),
     GNUNET_PQ_query_param_end
   };
@@ -380,6 +379,8 @@ irbt_cb_table_known_coins (struct PostgresClosure *pg,
       &td->details.known_coins.denom_sig),
     GNUNET_PQ_query_param_uint64 (
       &td->details.known_coins.denominations_serial),
+    TALER_PQ_query_param_amount (
+      &td->details.known_coins.remaining),
     GNUNET_PQ_query_param_end
   };
 
@@ -504,9 +505,6 @@ static enum GNUNET_DB_QueryStatus
 irbt_cb_table_deposits (struct PostgresClosure *pg,
                         const struct TALER_EXCHANGEDB_TableData *td)
 {
-  uint8_t tiny = td->details.deposits.tiny ? 1 : 0;
-  uint8_t done = td->details.deposits.done ? 1 : 0;
-  uint8_t extension_blocked = td->details.deposits.extension_blocked ? 1 : 0;
   struct GNUNET_PQ_QueryParam params[] = {
     GNUNET_PQ_query_param_uint64 (&td->serial),
     GNUNET_PQ_query_param_uint64 (&td->details.deposits.shard),
@@ -523,9 +521,9 @@ irbt_cb_table_deposits (struct PostgresClosure *pg,
     GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.coin_sig),
     GNUNET_PQ_query_param_auto_from_type (&td->details.deposits.wire_salt),
     GNUNET_PQ_query_param_uint64 (&td->details.deposits.wire_target_serial_id),
-    GNUNET_PQ_query_param_auto_from_type (&tiny),
-    GNUNET_PQ_query_param_auto_from_type (&done),
-    GNUNET_PQ_query_param_auto_from_type (&extension_blocked),
+    GNUNET_PQ_query_param_bool (td->details.deposits.tiny),
+    GNUNET_PQ_query_param_bool (td->details.deposits.done),
+    GNUNET_PQ_query_param_bool (td->details.deposits.extension_blocked),
     GNUNET_PQ_query_param_uint64 (
       &td->details.deposits.extension_details_serial_id),
     GNUNET_PQ_query_param_end
diff --git a/src/exchangedb/lrbt_callbacks.c b/src/exchangedb/lrbt_callbacks.c
index 74b99cd4..1f2ad604 100644
--- a/src/exchangedb/lrbt_callbacks.c
+++ b/src/exchangedb/lrbt_callbacks.c
@@ -658,6 +658,7 @@ lrbt_cb_table_known_coins (void *cls,
                            unsigned int num_results)
 {
   struct LookupRecordsByTableContext *ctx = cls;
+  struct PostgresClosure *pg = ctx->pg;
   struct TALER_EXCHANGEDB_TableData td = {
     .table = TALER_EXCHANGEDB_RT_KNOWN_COINS
   };
@@ -677,6 +678,9 @@ lrbt_cb_table_known_coins (void *cls,
       GNUNET_PQ_result_spec_uint64 (
         "denominations_serial",
         &td.details.known_coins.denominations_serial),
+      TALER_PQ_RESULT_SPEC_AMOUNT (
+        "remaining",
+        &td.details.known_coins.remaining),
       GNUNET_PQ_result_spec_end
     };
 
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index b9e5bc8f..12f18d0b 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -2227,6 +2227,8 @@ prepare_statements (struct PostgresClosure *pg)
       ",coin_pub"
       ",denom_sig"
       ",denominations_serial"
+      ",remaining_val"
+      ",remaining_frac"
       " FROM known_coins"
       " WHERE known_coin_id > $1"
       " ORDER BY known_coin_id ASC;",
@@ -2522,9 +2524,11 @@ prepare_statements (struct PostgresClosure *pg)
       ",coin_pub"
       ",denom_sig"
       ",denominations_serial"
+      ",remaining_val"
+      ",remaining_frac"
       ") VALUES "
-      "($1, $2, $3, $4);",
-      4),
+      "($1, $2, $3, $4, $5, $6);",
+      6),
     GNUNET_PQ_make_prepare (
       "insert_into_table_refresh_commitments",
       "INSERT INTO refresh_commitments"
diff --git a/src/include/taler_exchangedb_plugin.h 
b/src/include/taler_exchangedb_plugin.h
index 6e3008ad..846183ee 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -301,6 +301,7 @@ struct TALER_EXCHANGEDB_TableData
       struct TALER_AgeCommitmentHash age_hash;
       uint64_t denominations_serial;
       struct TALER_DenominationSignature denom_sig;
+      struct TALER_Amount remaining;
     } known_coins;
 
     struct

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