aboutsummaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_connect_with_state.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-07-04 15:37:34 +0200
committerChristian Grothoff <christian@grothoff.org>2023-07-04 15:37:46 +0200
commitff8349e6e7b7a898f3a9b0f69c44fa4a2a6a3fb1 (patch)
tree403cdc1e3a772a3415e14bcc6e9c6a4a78a4beba /src/testing/testing_api_cmd_connect_with_state.c
parent47620fa81b74a090767443445048ec9e3c15456e (diff)
downloadexchange-ff8349e6e7b7a898f3a9b0f69c44fa4a2a6a3fb1.tar.xz
more exchange API refactoring
Diffstat (limited to 'src/testing/testing_api_cmd_connect_with_state.c')
-rw-r--r--src/testing/testing_api_cmd_connect_with_state.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/testing/testing_api_cmd_connect_with_state.c b/src/testing/testing_api_cmd_connect_with_state.c
index 95e860f17..81587248d 100644
--- a/src/testing/testing_api_cmd_connect_with_state.c
+++ b/src/testing/testing_api_cmd_connect_with_state.c
@@ -26,6 +26,9 @@
#include "taler_testing_lib.h"
+// FIXME: this is now duplicated with testing_api_cmd_check_keys!
+// FIXME: this is now duplicated with testing_api_cmd_get_exchange!
+
/**
* Internal state for a connect-with-state CMD.
*/
@@ -46,13 +49,19 @@ struct ConnectWithStateState
/**
* New exchange handle.
*/
- struct TALER_EXCHANGE_Handle *exchange;
+ struct TALER_EXCHANGE_GetKeysHandle *exchange;
+
+ /**
+ * Keys handle.
+ */
+ struct TALER_EXCHANGE_Keys *keys;
};
static void
cert_cb (void *cls,
- const struct TALER_EXCHANGE_KeysResponse *kr)
+ const struct TALER_EXCHANGE_KeysResponse *kr,
+ struct TALER_EXCHANGE_Keys *keys)
{
struct ConnectWithStateState *cwss = cls;
struct TALER_TESTING_Interpreter *is = cwss->is;
@@ -72,6 +81,7 @@ cert_cb (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
+ cwss->keys = keys;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got %d DK from /keys\n",
kr->details.ok.keys->num_denom_keys);
@@ -113,14 +123,12 @@ connect_with_state_run (void *cls,
TALER_TESTING_get_trait_exchange_url (state_cmd,
&exchange_url));
cwss->exchange
- = TALER_EXCHANGE_connect (
+ = TALER_EXCHANGE_get_keys (
TALER_TESTING_interpreter_get_context (is),
exchange_url,
+ TALER_EXCHANGE_keys_from_json (serialized_keys),
&cert_cb,
- cwss,
- TALER_EXCHANGE_OPTION_DATA,
- serialized_keys,
- TALER_EXCHANGE_OPTION_END);
+ cwss);
}
@@ -141,7 +149,8 @@ connect_with_state_traits (void *cls,
{
struct ConnectWithStateState *cwss = cls;
struct TALER_TESTING_Trait traits[] = {
- TALER_TESTING_make_trait_exchange (cwss->exchange),
+ TALER_TESTING_make_trait_keys (cwss->keys),
+ // FIXME: also expose exchange_url as trait
TALER_TESTING_trait_end ()
};
@@ -165,6 +174,13 @@ connect_with_state_cleanup (void *cls,
{
struct ConnectWithStateState *cwss = cls;
+ TALER_EXCHANGE_keys_decref (cwss->keys);
+ cwss->keys = NULL;
+ if (NULL != cwss->exchange)
+ {
+ TALER_EXCHANGE_get_keys_cancel (cwss->exchange);
+ cwss->exchange = NULL;
+ }
GNUNET_free (cwss);
}