[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 01/02: fix currency, cost - assembler
From: |
gnunet |
Subject: |
[taler-anastasis] 01/02: fix currency, cost - assembler |
Date: |
Fri, 19 Jun 2020 09:44:01 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit 0ba0a03ba9529fb830494e90b0b9d495f41009e0
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Thu Jun 18 14:55:02 2020 +0000
fix currency, cost - assembler
---
src/cli/anastasis-cli-assembler.c | 50 +++++++++++++++++++++++++--------------
1 file changed, 32 insertions(+), 18 deletions(-)
diff --git a/src/cli/anastasis-cli-assembler.c
b/src/cli/anastasis-cli-assembler.c
index 1fcf69e..0dd02a3 100644
--- a/src/cli/anastasis-cli-assembler.c
+++ b/src/cli/anastasis-cli-assembler.c
@@ -92,6 +92,11 @@ struct ConfigState
*/
unsigned int http_status;
+ /**
+ * Challenge the ConfigState refers to.
+ */
+ struct ANASTASIS_ChallengeInformation *ci;
+
/**
* The /config GET operation handle.
*/
@@ -486,8 +491,32 @@ config_cb (void *cls,
return;
}
- cs->cost = *question_cost;
- cs->currency = conf_currency;
+ cs->ci->cost = GNUNET_new (struct TALER_Amount);
+ GNUNET_memcpy (cs->ci->cost,
+ question_cost,
+ sizeof (*question_cost));
+ cs->ci->currency = conf_currency;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "At %s:%d cost is %s\n", __FILE__, __LINE__,
+ TALER_amount_to_string (cs->ci->cost));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "At %s:%d currency is %s\n", __FILE__, __LINE__,
+ cs->ci->currency);
+
+ unsigned int contains = 0;
+ for (unsigned int i = 0; i < challenges_length; i++)
+ {
+ if (0 == uuid_compare (challenges[i].uuid, cs->ci->uuid))
+ {
+ contains = 1;
+ break;
+ }
+ }
+ if (0 == contains)
+ GNUNET_array_append (challenges,
+ challenges_length,
+ *cs->ci);
}
@@ -508,6 +537,7 @@ challenge_cb (void *cls,
struct ConfigState *cs = GNUNET_new (struct ConfigState);
cs->http_status = MHD_HTTP_OK;
+ cs->ci = ci;
cs->co = ANASTASIS_get_config (ctx,
ci->url,
config_cb,
@@ -517,22 +547,6 @@ challenge_cb (void *cls,
GNUNET_break (0);
return;
}
- ci->cost = &cs->cost;
- ci->currency = cs->currency;
-
- unsigned int contains = 0;
- for (unsigned int i = 0; i < challenges_length; i++)
- {
- if (0 == uuid_compare (challenges[i].uuid, ci->uuid))
- {
- contains = 1;
- break;
- }
- }
- if (0 == contains)
- GNUNET_array_append (challenges,
- challenges_length,
- *ci);
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.