gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: scope reduction, mark possible p


From: gnunet
Subject: [taler-exchange] branch master updated: scope reduction, mark possible places for improvement
Date: Mon, 23 Mar 2020 21:36:51 +0100

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 0bd53ed4 scope reduction, mark possible places for improvement
0bd53ed4 is described below

commit 0bd53ed443d8e95d52cc6fa40d5fd4a24be27592
Author: Christian Grothoff <address@hidden>
AuthorDate: Mon Mar 23 21:36:49 2020 +0100

    scope reduction, mark possible places for improvement
---
 src/auditor/taler-helper-auditor-coins.c | 63 ++++++++++++++++++--------------
 1 file changed, 35 insertions(+), 28 deletions(-)

diff --git a/src/auditor/taler-helper-auditor-coins.c 
b/src/auditor/taler-helper-auditor-coins.c
index 96155043..af417215 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -1235,6 +1235,7 @@ refresh_session_cb (void *cls,
                                   &issue->denom_hash);
   if (NULL == dso)
   {
+    // FIXME: handle more nicely!?!
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
@@ -1440,6 +1441,7 @@ deposit_cb (void *cls,
   if (NULL == ds)
   {
     GNUNET_break (0);
+    // FIXME: handle/report more nicely!??!
     return GNUNET_SYSERR;
   }
   if (GNUNET_SYSERR ==
@@ -1534,7 +1536,6 @@ refund_cb (void *cls,
   struct CoinContext *cc = cls;
   const struct TALER_DenominationKeyValidityPS *issue;
   struct DenominationSummary *ds;
-  struct TALER_RefundRequestPS rr;
   struct TALER_Amount amount_without_fee;
   struct TALER_Amount refund_fee;
   enum GNUNET_DB_QueryStatus qs;
@@ -1559,34 +1560,39 @@ refund_cb (void *cls,
   }
 
   /* verify refund signature */
-  rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND);
-  rr.purpose.size = htonl (sizeof (rr));
-  rr.h_contract_terms = *h_contract_terms;
-  rr.coin_pub = *coin_pub;
-  rr.merchant = *merchant_pub;
-  rr.rtransaction_id = GNUNET_htonll (rtransaction_id);
-  TALER_amount_hton (&rr.refund_amount,
-                     amount_with_fee);
-  rr.refund_fee = issue->fee_refund;
-  if (GNUNET_OK !=
-      GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND,
-                                  &rr.purpose,
-                                  &merchant_sig->eddsa_sig,
-                                  &merchant_pub->eddsa_pub))
   {
-    TALER_ARL_report (report_bad_sig_losses,
-                      json_pack ("{s:s, s:I, s:o, s:o}",
-                                 "operation", "refund",
-                                 "row", (json_int_t) rowid,
-                                 "loss", TALER_JSON_from_amount (
-                                   amount_with_fee),
-                                 "key_pub", GNUNET_JSON_from_data_auto (
-                                   merchant_pub)));
-    GNUNET_assert (GNUNET_OK ==
-                   TALER_amount_add (&total_bad_sig_loss,
-                                     &total_bad_sig_loss,
-                                     amount_with_fee));
-    return GNUNET_OK;
+    struct TALER_RefundRequestPS rr = {
+      .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND),
+      .purpose.size = htonl (sizeof (rr)),
+      .h_contract_terms = *h_contract_terms,
+      .coin_pub = *coin_pub,
+      .merchant = *merchant_pub,
+      .rtransaction_id = GNUNET_htonll (rtransaction_id),
+      .refund_fee = issue->fee_refund
+    };
+
+    TALER_amount_hton (&rr.refund_amount,
+                       amount_with_fee);
+    if (GNUNET_OK !=
+        GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND,
+                                    &rr.purpose,
+                                    &merchant_sig->eddsa_sig,
+                                    &merchant_pub->eddsa_pub))
+    {
+      TALER_ARL_report (report_bad_sig_losses,
+                        json_pack ("{s:s, s:I, s:o, s:o}",
+                                   "operation", "refund",
+                                   "row", (json_int_t) rowid,
+                                   "loss", TALER_JSON_from_amount (
+                                     amount_with_fee),
+                                   "key_pub", GNUNET_JSON_from_data_auto (
+                                     merchant_pub)));
+      GNUNET_assert (GNUNET_OK ==
+                     TALER_amount_add (&total_bad_sig_loss,
+                                       &total_bad_sig_loss,
+                                       amount_with_fee));
+      return GNUNET_OK;
+    }
   }
 
   TALER_amount_ntoh (&refund_fee,
@@ -1617,6 +1623,7 @@ refund_cb (void *cls,
   if (NULL == ds)
   {
     GNUNET_break (0);
+    // FIXME: handle more nicely!?!?
     return GNUNET_SYSERR;
   }
   GNUNET_assert (GNUNET_OK ==

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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