[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] 69/152: TALER_TESTING_cmd_admin_add_incoming_with_ref f
From: |
gnunet |
Subject: |
[taler-exchange] 69/152: TALER_TESTING_cmd_admin_add_incoming_with_ref finds reserve_pub if reserve_priv doesn't exist |
Date: |
Sun, 05 Jul 2020 20:47:05 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository exchange.
commit 1aa16875f1ff71f86f14f6d395b9116c4c4420b9
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Tue Jun 16 21:37:17 2020 -0400
TALER_TESTING_cmd_admin_add_incoming_with_ref finds reserve_pub if
reserve_priv doesn't exist
---
contrib/gana | 2 +-
src/include/taler_testing_lib.h | 2 +-
.../testing_api_cmd_bank_admin_add_incoming.c | 112 +++++++++++++++------
3 files changed, 83 insertions(+), 33 deletions(-)
diff --git a/contrib/gana b/contrib/gana
index 96c6015b..29ed6e80 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 96c6015bc7119bc7533be9fe7031bfe4dceaaf78
+Subproject commit 29ed6e806f8645679edf7cfbedc0f6b26ab83dbb
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 6a4fa024..8274555c 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -1075,7 +1075,7 @@ TALER_TESTING_cmd_admin_add_incoming (
* @param payto_debit_account which account sends money.
* @param auth authentication data
* @param ref reference to a command that can offer a reserve
- * private key.
+ * private key or public key.
* @return the command.
*/
struct TALER_TESTING_Command
diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c
b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
index 2399825d..d8b1d7b0 100644
--- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c
+++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c
@@ -81,6 +81,11 @@ struct AdminAddIncomingState
*/
struct TALER_ReservePrivateKeyP reserve_priv;
+ /**
+ * Whether we know the private key or not.
+ */
+ bool reserve_priv_known;
+
/**
* Reserve public key matching @e reserve_priv.
*/
@@ -271,6 +276,7 @@ admin_add_incoming_run (void *cls,
struct TALER_TESTING_Interpreter *is)
{
struct AdminAddIncomingState *fts = cls;
+ bool have_public = false;
(void) cmd;
/* Use reserve public key as subject */
@@ -278,6 +284,7 @@ admin_add_incoming_run (void *cls,
{
const struct TALER_TESTING_Command *ref;
const struct TALER_ReservePrivateKeyP *reserve_priv;
+ const struct TALER_ReservePublicKeyP *reserve_pub;
ref = TALER_TESTING_interpreter_lookup_command
(is, fts->reserve_reference);
@@ -292,11 +299,23 @@ admin_add_incoming_run (void *cls,
0,
&reserve_priv))
{
- GNUNET_break (0);
- TALER_TESTING_interpreter_fail (is);
- return;
+ if (GNUNET_OK != TALER_TESTING_get_trait_reserve_pub (ref,
+ 0,
+ &reserve_pub))
+ {
+ GNUNET_break (0);
+ TALER_TESTING_interpreter_fail (is);
+ return;
+ }
+ have_public = true;
+ fts->reserve_pub.eddsa_pub = reserve_pub->eddsa_pub;
+ fts->reserve_priv_known = false;
+ }
+ else
+ {
+ fts->reserve_priv.eddsa_priv = reserve_priv->eddsa_priv;
+ fts->reserve_priv_known = true;
}
- fts->reserve_priv.eddsa_priv = reserve_priv->eddsa_priv;
}
else
{
@@ -349,6 +368,7 @@ admin_add_incoming_run (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
+ fts->reserve_priv_known = true;
GNUNET_free (keys);
GNUNET_free (section);
GNUNET_CONFIGURATION_destroy (cfg);
@@ -358,10 +378,12 @@ admin_add_incoming_run (void *cls,
/* No referenced reserve, no instance to take priv
* from, no explicit subject given: create new key! */
GNUNET_CRYPTO_eddsa_key_create (&fts->reserve_priv.eddsa_priv);
+ fts->reserve_priv_known = true;
}
}
- GNUNET_CRYPTO_eddsa_key_get_public (&fts->reserve_priv.eddsa_priv,
- &fts->reserve_pub.eddsa_pub);
+ if (! have_public)
+ GNUNET_CRYPTO_eddsa_key_get_public (&fts->reserve_priv.eddsa_priv,
+ &fts->reserve_pub.eddsa_pub);
fts->reserve_history.type = TALER_EXCHANGE_RTT_CREDIT;
fts->reserve_history.amount = fts->amount;
fts->reserve_history.details.in_details.sender_url
@@ -432,30 +454,58 @@ admin_add_incoming_traits (void *cls,
unsigned int index)
{
struct AdminAddIncomingState *fts = cls;
- struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_bank_row (&fts->serial_id),
- TALER_TESTING_make_trait_payto (TALER_TESTING_PT_DEBIT,
- fts->payto_debit_account),
- /* Used as a marker, content does not matter */
- TALER_TESTING_make_trait_payto (TALER_TESTING_PT_CREDIT,
- "payto://void/the-exchange"),
- TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BANK_ACCOUNT_URL,
- fts->exchange_credit_url),
- TALER_TESTING_make_trait_amount_obj (0, &fts->amount),
- TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
- TALER_TESTING_make_trait_reserve_priv (0,
- &fts->reserve_priv),
- TALER_TESTING_make_trait_reserve_pub (0,
- &fts->reserve_pub),
- TALER_TESTING_make_trait_reserve_history (0,
- &fts->reserve_history),
- TALER_TESTING_trait_end ()
- };
-
- return TALER_TESTING_get_trait (traits,
- ret,
- trait,
- index);
+ if (fts->reserve_priv_known)
+ {
+ struct TALER_TESTING_Trait traits[] = {
+ TALER_TESTING_make_trait_bank_row (&fts->serial_id),
+ TALER_TESTING_make_trait_payto (TALER_TESTING_PT_DEBIT,
+ fts->payto_debit_account),
+ /* Used as a marker, content does not matter */
+ TALER_TESTING_make_trait_payto (TALER_TESTING_PT_CREDIT,
+ "payto://void/the-exchange"),
+ TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BANK_ACCOUNT_URL,
+ fts->exchange_credit_url),
+ TALER_TESTING_make_trait_amount_obj (0, &fts->amount),
+ TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
+ TALER_TESTING_make_trait_reserve_priv (0,
+ &fts->reserve_priv),
+ TALER_TESTING_make_trait_reserve_pub (0,
+ &fts->reserve_pub),
+ TALER_TESTING_make_trait_reserve_history (0,
+ &fts->reserve_history),
+ TALER_TESTING_trait_end ()
+ };
+
+ return TALER_TESTING_get_trait (traits,
+ ret,
+ trait,
+ index);
+ }
+ else
+ {
+ struct TALER_TESTING_Trait traits[] = {
+ TALER_TESTING_make_trait_bank_row (&fts->serial_id),
+ TALER_TESTING_make_trait_payto (TALER_TESTING_PT_DEBIT,
+ fts->payto_debit_account),
+ /* Used as a marker, content does not matter */
+ TALER_TESTING_make_trait_payto (TALER_TESTING_PT_CREDIT,
+ "payto://void/the-exchange"),
+ TALER_TESTING_make_trait_url (TALER_TESTING_UT_EXCHANGE_BANK_ACCOUNT_URL,
+ fts->exchange_credit_url),
+ TALER_TESTING_make_trait_amount_obj (0, &fts->amount),
+ TALER_TESTING_make_trait_absolute_time (0, &fts->timestamp),
+ TALER_TESTING_make_trait_reserve_pub (0,
+ &fts->reserve_pub),
+ TALER_TESTING_make_trait_reserve_history (0,
+ &fts->reserve_history),
+ TALER_TESTING_trait_end ()
+ };
+
+ return TALER_TESTING_get_trait (traits,
+ ret,
+ trait,
+ index);
+ }
}
@@ -548,7 +598,7 @@ TALER_TESTING_cmd_admin_add_incoming (const char *label,
* @param payto_debit_account which account sends money
* @param auth authentication data
* @param ref reference to a command that can offer a reserve
- * private key.
+ * private key or public key.
* @return the command.
*/
struct TALER_TESTING_Command
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-exchange] 52/152: fix drop call, (continued)
- [taler-exchange] 52/152: fix drop call, gnunet, 2020/07/05
- [taler-exchange] 51/152: merge, gnunet, 2020/07/05
- [taler-exchange] 54/152: ecs, gnunet, 2020/07/05
- [taler-exchange] 56/152: update ECs, gnunet, 2020/07/05
- [taler-exchange] 61/152: bringing gana up to date so uncrustify accepts taler_error_codes.h, gnunet, 2020/07/05
- [taler-exchange] 59/152: fixed endianness in taler_sq_lib, gnunet, 2020/07/05
- [taler-exchange] 57/152: created taler_sq_lib, gnunet, 2020/07/05
- [taler-exchange] 62/152: do init submodules, gnunet, 2020/07/05
- [taler-exchange] 68/152: synchronize with latest GANA, gnunet, 2020/07/05
- [taler-exchange] 66/152: moved yna to exchange, gnunet, 2020/07/05
- [taler-exchange] 69/152: TALER_TESTING_cmd_admin_add_incoming_with_ref finds reserve_pub if reserve_priv doesn't exist,
gnunet <=
- [taler-exchange] 72/152: Merge branch 'protocolv8' of git+ssh://git.taler.net/exchange into protocolv8, gnunet, 2020/07/05
- [taler-exchange] 75/152: clarify with/without wire fee issue, sanity checks on currencies, gnunet, 2020/07/05
- [taler-exchange] 78/152: fix #6236, gnunet, 2020/07/05
- [taler-exchange] 74/152: traits for int64_t and json_t, gnunet, 2020/07/05
- [taler-exchange] 50/152: more ecs, gnunet, 2020/07/05
- [taler-exchange] 49/152: use unregister, gnunet, 2020/07/05
- [taler-exchange] 53/152: fix auditor drop, gnunet, 2020/07/05
- [taler-exchange] 55/152: more ECs, gnunet, 2020/07/05
- [taler-exchange] 58/152: implemented the other functions for taler_sq_lib, gnunet, 2020/07/05
- [taler-exchange] 60/152: taler_error_codes.h auto generated from gnunet/gana.git as a submodule, gnunet, 2020/07/05