gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: handle purse deposit client-side


From: gnunet
Subject: [taler-exchange] branch master updated: handle purse deposit client-side
Date: Mon, 23 May 2022 16:11:25 +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 2e80f51e handle purse deposit client-side
2e80f51e is described below

commit 2e80f51e2515da3cb4bae47ccf3bee9ddf3d4482
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon May 23 16:11:21 2022 +0200

    handle purse deposit client-side
---
 src/lib/exchange_api_common.c | 37 ++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index a4282283..caa8407f 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -1167,8 +1167,39 @@ help_purse_deposit (struct CoinHistoryParseContext *pc,
                     const struct TALER_Amount *amount,
                     json_t *transaction)
 {
-  GNUNET_break (0); // FIXME: implement!
-  return GNUNET_SYSERR;
+  struct TALER_PurseContractPublicKeyP purse_pub;
+  struct TALER_CoinSpendSignatureP coin_sig;
+  const char *exchange_base_url;
+  struct GNUNET_JSON_Specification spec[] = {
+    GNUNET_JSON_spec_fixed_auto ("purse_pub",
+                                 &purse_pub),
+    GNUNET_JSON_spec_fixed_auto ("coin_sig",
+                                 &coin_sig),
+    GNUNET_JSON_spec_string ("exchange_base_url",
+                             &exchange_base_url),
+    GNUNET_JSON_spec_end ()
+  };
+
+  if (GNUNET_OK !=
+      GNUNET_JSON_parse (transaction,
+                         spec,
+                         NULL, NULL))
+  {
+    GNUNET_break_op (0);
+    return GNUNET_SYSERR;
+  }
+  if (GNUNET_OK !=
+      TALER_wallet_purse_deposit_verify (
+        exchange_base_url,
+        &purse_pub,
+        amount,
+        pc->coin_pub,
+        &coin_sig))
+  {
+    GNUNET_break_op (0);
+    return GNUNET_SYSERR;
+  }
+  return GNUNET_YES;
 }
 
 
@@ -1192,7 +1223,7 @@ TALER_EXCHANGE_verify_coin_history (
     { "RECOUP", &help_recoup },
     { "RECOUP-REFRESH", &help_recoup_refresh },
     { "OLD-COIN-RECOUP", &help_old_coin_recoup },
-    { "PURSE_DEPOSIT", &help_purse_deposit },
+    { "PURSE-DEPOSIT", &help_purse_deposit },
     { NULL, NULL }
   };
   struct CoinHistoryParseContext pc = {

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