aboutsummaryrefslogtreecommitdiff
path: root/src/lib/exchange_api_recoup_refresh.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/exchange_api_recoup_refresh.c')
-rw-r--r--src/lib/exchange_api_recoup_refresh.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/lib/exchange_api_recoup_refresh.c b/src/lib/exchange_api_recoup_refresh.c
index 7b42aa7eb..f5745deb0 100644
--- a/src/lib/exchange_api_recoup_refresh.c
+++ b/src/lib/exchange_api_recoup_refresh.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2017-2022 Taler Systems SA
+ Copyright (C) 2017-2023 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -40,9 +40,9 @@ struct TALER_EXCHANGE_RecoupRefreshHandle
{
/**
- * The connection to exchange this request handle will use
+ * The keys of the exchange this request handle will use
*/
- struct TALER_EXCHANGE_Handle *exchange;
+ struct TALER_EXCHANGE_Keys *keys;
/**
* The url for this request.
@@ -144,10 +144,8 @@ handle_recoup_refresh_finished (void *cls,
.hr.reply = j,
.hr.http_status = (unsigned int) response_code
};
- const struct TALER_EXCHANGE_Keys *keys;
ph->job = NULL;
- keys = TALER_EXCHANGE_get_keys (ph->exchange);
switch (response_code)
{
case 0:
@@ -191,7 +189,7 @@ handle_recoup_refresh_finished (void *cls,
rrr.hr.ec = TALER_JSON_get_error_code (j);
rrr.hr.hint = TALER_JSON_get_error_hint (j);
if (GNUNET_OK !=
- TALER_EXCHANGE_get_min_denomination_ (keys,
+ TALER_EXCHANGE_get_min_denomination_ (ph->keys,
&min_key))
{
GNUNET_break (0);
@@ -201,7 +199,7 @@ handle_recoup_refresh_finished (void *cls,
}
if (GNUNET_OK !=
TALER_EXCHANGE_check_coin_conflict_ (
- keys,
+ ph->keys,
j,
&ph->pk,
&ph->coin_pub,
@@ -246,7 +244,9 @@ handle_recoup_refresh_finished (void *cls,
struct TALER_EXCHANGE_RecoupRefreshHandle *
TALER_EXCHANGE_recoup_refresh (
- struct TALER_EXCHANGE_Handle *exchange,
+ struct GNUNET_CURL_Context *ctx,
+ const char *url,
+ struct TALER_EXCHANGE_Keys *keys,
const struct TALER_EXCHANGE_DenomPublicKey *pk,
const struct TALER_DenominationSignature *denom_sig,
const struct TALER_ExchangeWithdrawValues *exchange_vals,
@@ -257,7 +257,6 @@ TALER_EXCHANGE_recoup_refresh (
void *recoup_cb_cls)
{
struct TALER_EXCHANGE_RecoupRefreshHandle *ph;
- struct GNUNET_CURL_Context *ctx;
struct TALER_DenominationHashP h_denom_pub;
json_t *recoup_obj;
CURL *eh;
@@ -266,10 +265,7 @@ TALER_EXCHANGE_recoup_refresh (
union TALER_DenominationBlindingKeyP bks;
GNUNET_assert (NULL != recoup_cb);
- GNUNET_assert (GNUNET_YES ==
- TEAH_handle_is_ready (exchange));
ph = GNUNET_new (struct TALER_EXCHANGE_RecoupRefreshHandle);
- ph->exchange = exchange;
ph->pk = *pk;
memset (&ph->pk.key,
0,
@@ -333,12 +329,13 @@ TALER_EXCHANGE_recoup_refresh (
*end = '\0';
GNUNET_snprintf (arg_str,
sizeof (arg_str),
- "/coins/%s/recoup-refresh",
+ "coins/%s/recoup-refresh",
pub_str);
}
- ph->url = TEAH_path_to_url (exchange,
- arg_str);
+ ph->url = TALER_url_join (url,
+ arg_str,
+ NULL);
if (NULL == ph->url)
{
json_decref (recoup_obj);
@@ -364,7 +361,7 @@ TALER_EXCHANGE_recoup_refresh (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"URL for recoup-refresh: `%s'\n",
ph->url);
- ctx = TEAH_handle_to_context (exchange);
+ ph->keys = TALER_EXCHANGE_keys_incref (keys);
ph->job = GNUNET_CURL_job_add2 (ctx,
eh,
ph->ctx.headers,
@@ -385,6 +382,7 @@ TALER_EXCHANGE_recoup_refresh_cancel (
}
GNUNET_free (ph->url);
TALER_curl_easy_post_finished (&ph->ctx);
+ TALER_EXCHANGE_keys_decref (ph->keys);
GNUNET_free (ph);
}