gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] branch master updated: implement logic for


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: implement logic for spending from tips in test interpreter
Date: Tue, 31 Oct 2017 15:26:40 +0100

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

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 2ce7e16  implement logic for spending from tips in test interpreter
2ce7e16 is described below

commit 2ce7e1622375cffa53701dd40e5e24b120fb8e89
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Oct 31 15:26:32 2017 +0100

    implement logic for spending from tips in test interpreter
---
 src/lib/test_merchant_api.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index c018a9e..e1aa993 100644
--- a/src/lib/test_merchant_api.c
+++ b/src/lib/test_merchant_api.c
@@ -20,7 +20,6 @@
  * @author Marcello Stanisci
  *
  * TODO:
- * - implement spending with coins from tips
  * - add test logic for tips to main test interpreter
  */
 #include "platform.h"
@@ -489,7 +488,9 @@ struct Command
 
       /**
        * ";"-separated list of references to withdrawn coins to be used
-       * in the payment.
+       * in the payment.  Each reference has the syntax "LABEL[/NUMBER]"
+       * where NUMBER refers to a particular coin (in case multiple coins
+       * were created in a step).
        */
       char *coin_ref;
 
@@ -2555,7 +2556,24 @@ interpreter_run (void *cls)
       do
       {
         const struct Command *coin_ref;
+        char *ctok;
+        unsigned int ci;
 
+        /* Token syntax is "LABEL[/NUMBER]" */
+        ctok = strchr (token, '/');
+        if (NULL != ctok)
+        {
+          *ctok = '\0';
+          ctok++;
+        }
+        if (1 != sscanf (ctok,
+                         "%u",
+                         &ci))
+        {
+          GNUNET_break (0);
+          fail (is);
+          return;
+        }
         GNUNET_assert (coin_ref = find_command (is,
                                                 token));
         switch (coin_ref->oc)
@@ -2566,6 +2584,11 @@ interpreter_run (void *cls)
           icoin->denom_sig = coin_ref->details.reserve_withdraw.sig;
           icoin->denom_value = coin_ref->details.reserve_withdraw.pk->value;
           break;
+        case OC_TIP_PICKUP:
+          icoin->coin_priv = coin_ref->details.tip_pickup.psa[ci].coin_priv;
+          icoin->denom_pub = coin_ref->details.tip_pickup.dks[ci]->key;
+          icoin->denom_sig = coin_ref->details.tip_pickup.sigs[ci];
+          icoin->denom_value = coin_ref->details.tip_pickup.dks[ci]->value;
         default:
           GNUNET_assert (0);
         }

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



reply via email to

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