diff options
author | Marcello Stanisci <stanisci.m@gmail.com> | 2018-12-12 14:45:25 +0100 |
---|---|---|
committer | Marcello Stanisci <stanisci.m@gmail.com> | 2018-12-12 14:45:25 +0100 |
commit | 208ba0d4b2a47d331a25babac9ab2f4918263f1b (patch) | |
tree | 6bca2a8fb020297a03590151a670c2ad19857466 | |
parent | 220e00696b268458ff2e011c172cff434a9553a3 (diff) |
/reserve/status CMD.
The logic extracts the reserve pub according to the
trait being a pub b64 encoding or a private key.
-rw-r--r-- | src/exchange-lib/testing_api_cmd_status.c | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/src/exchange-lib/testing_api_cmd_status.c b/src/exchange-lib/testing_api_cmd_status.c index f8186131e..77a5cbf9a 100644 --- a/src/exchange-lib/testing_api_cmd_status.c +++ b/src/exchange-lib/testing_api_cmd_status.c @@ -167,23 +167,42 @@ status_run (void *cls, return; } - if (GNUNET_OK != - TALER_TESTING_get_trait_reserve_priv (create_reserve, - 0, - &reserve_priv)) + if (GNUNET_OK == TALER_TESTING_get_trait_reserve_priv + (create_reserve, + 0, + &reserve_priv)) { - GNUNET_break (0); - TALER_TESTING_interpreter_fail (is); - return; + GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv, + &reserve_pub.eddsa_pub); + } + else + { + const char *transfer_subject; + + if (GNUNET_OK != TALER_TESTING_get_trait_transfer_subject + (create_reserve, + 0, + &transfer_subject)) + { + GNUNET_break (0); + TALER_LOG_ERROR + ("The reserve has neither a priv nor a subject line..\n"); + TALER_TESTING_interpreter_fail (is); + return; + + } + + GNUNET_STRINGS_string_to_data + (transfer_subject, + strlen (transfer_subject), + &reserve_pub.eddsa_pub, + sizeof (struct TALER_ReservePublicKeyP)); } - GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv, - &reserve_pub.eddsa_pub); - ss->rsh - = TALER_EXCHANGE_reserve_status (ss->exchange, - &reserve_pub, - &reserve_status_cb, - ss); + ss->rsh = TALER_EXCHANGE_reserve_status (ss->exchange, + &reserve_pub, + &reserve_status_cb, + ss); } |