gnunet-svn
[Top][All Lists]
Advanced

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

[taler-merchant] 16/24: introduce TALER_wallet_deposit_verify


From: gnunet
Subject: [taler-merchant] 16/24: introduce TALER_wallet_deposit_verify
Date: Wed, 17 Nov 2021 12:44:39 +0100

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

grothoff pushed a commit to branch master
in repository merchant.

commit ab6fd118b5cd23c414912f4fb7087f16d12f21a0
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Nov 6 16:56:33 2021 +0100

    introduce TALER_wallet_deposit_verify
---
 src/lib/merchant_api_post_order_pay.c | 36 +++++++++++++++--------------------
 1 file changed, 15 insertions(+), 21 deletions(-)

diff --git a/src/lib/merchant_api_post_order_pay.c 
b/src/lib/merchant_api_post_order_pay.c
index 98e2f359..08f041d4 100644
--- a/src/lib/merchant_api_post_order_pay.c
+++ b/src/lib/merchant_api_post_order_pay.c
@@ -600,27 +600,14 @@ TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx,
 
   {
     struct TALER_MERCHANT_PaidCoin pc[num_coins];
-    struct TALER_DepositRequestPS dr = {
-      .purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT),
-      .purpose.size = htonl (sizeof (dr)),
-      .h_contract_terms = *h_contract_terms,
-      .h_wire = *h_wire,
-      .wallet_timestamp = GNUNET_TIME_absolute_hton (timestamp),
-      .refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline),
-      .merchant = *merchant_pub
-    };
 
     for (unsigned int i = 0; i<num_coins; i++)
     {
       const struct TALER_MERCHANT_PayCoin *coin = &coins[i]; // coin priv.
       struct TALER_MERCHANT_PaidCoin *p = &pc[i]; // coin pub.
       struct TALER_Amount fee;
+      struct TALER_DenominationHash h_denom_pub;
 
-      /* prepare 'dr' for this coin to generate coin signature */
-      GNUNET_CRYPTO_eddsa_key_get_public (&coin->coin_priv.eddsa_priv,
-                                          &dr.coin_pub.eddsa_pub);
-      TALER_amount_hton (&dr.amount_with_fee,
-                         &coin->amount_with_fee);
       if (0 >
           TALER_amount_subtract (&fee,
                                  &coin->amount_with_fee,
@@ -631,17 +618,24 @@ TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx,
         GNUNET_break (0);
         return NULL;
       }
-      TALER_amount_hton (&dr.deposit_fee,
-                         &fee);
       TALER_denom_pub_hash (&coin->denom_pub,
-                            &dr.h_denom_pub);
-      GNUNET_CRYPTO_eddsa_sign (&coin->coin_priv.eddsa_priv,
-                                &dr,
-                                &p->coin_sig.eddsa_signature);
+                            &h_denom_pub);
+      TALER_wallet_deposit_sign (&coin->amount_with_fee,
+                                 &fee,
+                                 h_wire,
+                                 h_contract_terms,
+                                 NULL /* h_extensions! */,
+                                 &h_denom_pub,
+                                 timestamp,
+                                 merchant_pub,
+                                 refund_deadline,
+                                 &coin->coin_priv,
+                                 &p->coin_sig);
       p->denom_pub = coin->denom_pub;
       p->denom_sig = coin->denom_sig;
       p->denom_value = coin->denom_value;
-      p->coin_pub = dr.coin_pub;
+      GNUNET_CRYPTO_eddsa_key_get_public (&coin->coin_priv.eddsa_priv,
+                                          &p->coin_pub.eddsa_pub);
       p->amount_with_fee = coin->amount_with_fee;
       p->amount_without_fee = coin->amount_without_fee;
       p->exchange_url = coin->exchange_url;

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