gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -fix comments


From: gnunet
Subject: [taler-exchange] branch master updated: -fix comments
Date: Tue, 14 Jun 2022 15:58: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 963477e0 -fix comments
963477e0 is described below

commit 963477e0640284a54b6e13c947940a0fd1e47bf3
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Jun 14 15:57:48 2022 +0200

    -fix comments
---
 src/auditor/taler-helper-auditor-coins.c    | 43 ++++++++---------------------
 src/exchange/taler-exchange-httpd_keys.c    | 11 ++++----
 src/exchangedb/plugin_exchangedb_postgres.c |  7 ++++-
 src/include/taler_exchangedb_plugin.h       |  1 +
 4 files changed, 23 insertions(+), 39 deletions(-)

diff --git a/src/auditor/taler-helper-auditor-coins.c 
b/src/auditor/taler-helper-auditor-coins.c
index b8037ff5..e3336484 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -1859,6 +1859,7 @@ refund_cb (void *cls,
  * the goal of auditing the purse refund's execution.
  *
  * @param cls closure
+ * @param rowid row of the purse-refund
  * @param amount_with_fee amount of the deposit into the purse
  * @param coin_pub coin that is to be refunded the @a given amount_with_fee
  * @param denom_pub denomination of @a coin_pub
@@ -1867,16 +1868,14 @@ refund_cb (void *cls,
 static enum GNUNET_GenericReturnValue
 purse_refund_coin_cb (
   void *cls,
+  uint64_t rowid,
   const struct TALER_Amount *amount_with_fee,
   const struct TALER_CoinSpendPublicKeyP *coin_pub,
   const struct TALER_DenominationPublicKey *denom_pub)
 {
   struct CoinContext *cc = cls;
-
-#if FIXME
   const struct TALER_EXCHANGEDB_DenominationKeyInformation *issue;
   struct DenominationSummary *ds;
-  struct TALER_Amount amount_without_fee;
   enum GNUNET_DB_QueryStatus qs;
 
   qs = TALER_ARL_get_denomination_info (denom_pub,
@@ -1896,24 +1895,8 @@ purse_refund_coin_cb (
     GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
     return GNUNET_SYSERR;
   }
-
-  if (TALER_ARL_SR_INVALID_NEGATIVE ==
-      TALER_ARL_amount_subtract_neg (&amount_without_fee,
-                                     amount_with_fee,
-                                     &issue->fees.refund))
-  {
-    report_amount_arithmetic_inconsistency ("refund (fee)",
-                                            rowid,
-                                            &amount_without_fee,
-                                            &issue->fees.refund,
-                                            -1);
-    if (TALER_ARL_do_abort ())
-      return GNUNET_SYSERR;
-    return GNUNET_OK;
-  }
-
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Refunding coin %s in denomination `%s' value %s\n",
+              "Aborted purse-deposit of coin %s in denomination `%s' value 
%s\n",
               TALER_B2S (coin_pub),
               GNUNET_h2s (&issue->denom_hash.hash),
               TALER_amount2s (amount_with_fee));
@@ -1924,38 +1907,34 @@ purse_refund_coin_cb (
                                  &issue->denom_hash);
   if (NULL == ds)
   {
-    report_row_inconsistency ("refund",
+    report_row_inconsistency ("purse-refund",
                               rowid,
-                              "denomination key for refunded coin unknown to 
auditor");
+                              "denomination key for purse-refunded coin 
unknown to auditor");
   }
   else
   {
     TALER_ARL_amount_add (&ds->denom_balance,
                           &ds->denom_balance,
-                          &amount_without_fee);
+                          amount_with_fee);
     TALER_ARL_amount_add (&ds->denom_risk,
                           &ds->denom_risk,
-                          &amount_without_fee);
+                          amount_with_fee);
     TALER_ARL_amount_add (&total_escrow_balance,
                           &total_escrow_balance,
-                          &amount_without_fee);
+                          amount_with_fee);
     TALER_ARL_amount_add (&total_risk,
                           &total_risk,
-                          &amount_without_fee);
+                          amount_with_fee);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "New balance of denomination `%s' after refund is %s\n",
+                "New balance of denomination `%s' after purse-refund is %s\n",
                 GNUNET_h2s (&issue->denom_hash.hash),
                 TALER_amount2s (&ds->denom_balance));
   }
-  /* update total refund fee balance */
-  TALER_ARL_amount_add (&total_refund_fee_income,
-                        &total_refund_fee_income,
-                        &issue->fees.refund);
+  /* update total deposit fee balance */
   TALER_ARL_amount_subtract (&total_deposit_fee_income,
                              &total_deposit_fee_income,
                              &issue->fees.deposit);
 
-#endif
   return GNUNET_OK;
 }
 
diff --git a/src/exchange/taler-exchange-httpd_keys.c 
b/src/exchange/taler-exchange-httpd_keys.c
index a8ca76da..b3f0eb48 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -177,10 +177,9 @@ struct HelperSignkey
 
 
 /**
- * State associated with the crypto helpers / security modules.
- * Created per-thread, but NOT updated when the #key_generation
- * is updated (instead constantly kept in sync whenever
- * #TEH_keys_get_state() is called).
+ * State associated with the crypto helpers / security modules.  NOT updated
+ * when the #key_generation is updated (instead constantly kept in sync
+ * whenever #TEH_keys_get_state() is called).
  */
 struct HelperState
 {
@@ -413,7 +412,7 @@ static struct TEH_KeyStateHandle *key_state;
 
 /**
  * Counter incremented whenever we have a reason to re-build the keys because
- * something external changed (in another thread).  See #TEH_keys_get_state() 
and
+ * something external changed.  See #TEH_keys_get_state() and
  * #TEH_keys_update_states() for uses of this variable.
  */
 static uint64_t key_generation;
@@ -2424,7 +2423,7 @@ TEH_keys_update_states ()
 
 
 /**
- * Obtain the key state for the current thread. Should ONLY be used
+ * Obtain the key state. Should ONLY be used
  * directly if @a management_only is true. Otherwise use #TEH_keys_get_state().
  *
  * @param management_only if we should NOT run 'finish_keys_response()'
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index f63790ca..20b3ba36 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -1524,7 +1524,8 @@ prepare_statements (struct PostgresClosure *pg)
     GNUNET_PQ_make_prepare (
       "audit_get_purse_deposits_by_purse",
       "SELECT"
-      " pd.amount_with_fee_val"
+      " pd.purse_deposit_serial_id"
+      ",pd.amount_with_fee_val"
       ",pd.amount_with_fee_frac"
       ",pd.coin_pub"
       ",denom.denom_pub"
@@ -10722,6 +10723,7 @@ purse_refund_coin_helper_cb (void *cls,
     struct TALER_Amount amount_with_fee;
     struct TALER_CoinSpendPublicKeyP coin_pub;
     struct TALER_DenominationPublicKey denom_pub;
+    uint64_t rowid;
     struct GNUNET_PQ_ResultSpec rs[] = {
       TALER_PQ_result_spec_denom_pub ("denom_pub",
                                       &denom_pub),
@@ -10729,6 +10731,8 @@ purse_refund_coin_helper_cb (void *cls,
                                    &amount_with_fee),
       GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
                                             &coin_pub),
+      GNUNET_PQ_result_spec_uint64 ("purse_deposit_serial_id",
+                                    &rowid),
       GNUNET_PQ_result_spec_end
     };
     enum GNUNET_GenericReturnValue ret;
@@ -10743,6 +10747,7 @@ purse_refund_coin_helper_cb (void *cls,
       return;
     }
     ret = dsc->cb (dsc->cb_cls,
+                   rowid,
                    &amount_with_fee,
                    &coin_pub,
                    &denom_pub);
diff --git a/src/include/taler_exchangedb_plugin.h 
b/src/include/taler_exchangedb_plugin.h
index 74498f88..eaac5cd3 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -2030,6 +2030,7 @@ typedef enum GNUNET_GenericReturnValue
 typedef enum GNUNET_GenericReturnValue
 (*TALER_EXCHANGEDB_PurseRefundCoinCallback)(
   void *cls,
+  uint64_t rowid,
   const struct TALER_Amount *amount_with_fee,
   const struct TALER_CoinSpendPublicKeyP *coin_pub,
   const struct TALER_DenominationPublicKey *denom_pub);

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