commit 2d72b425d385eb0ee71a10716fba2a42ef4789d9
parent 66f4b840038776d130de644e9c4cc17845cf873d
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Sun, 25 Jan 2026 16:11:18 +0900
return exchange_currency as per #10546
Diffstat:
3 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_exchanges.c b/src/backend/taler-merchant-httpd_exchanges.c
@@ -238,15 +238,8 @@ TMH_EXCHANGES_get_currency (
}
-/**
- * Lookup exchange by @a exchange_url. Create one
- * if it does not exist.
- *
- * @param exchange_url base URL to match against
- * @return fresh entry if exchange was not yet known
- */
-static struct TMH_Exchange *
-lookup_exchange (const char *exchange_url)
+struct TMH_Exchange *
+TMH_EXCHANGES_lookup_exchange (const char *exchange_url)
{
for (struct TMH_Exchange *exchange = exchange_head;
NULL != exchange;
@@ -262,7 +255,7 @@ bool
TMH_EXCHANGES_check_trusted (
const char *exchange_url)
{
- struct TMH_Exchange *exchange = lookup_exchange (exchange_url);
+ struct TMH_Exchange *exchange = TMH_EXCHANGES_lookup_exchange (exchange_url);
if (NULL == exchange)
return false;
@@ -480,7 +473,7 @@ TMH_EXCHANGES_keys4exchange (
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Trying to find chosen exchange `%s'\n",
chosen_exchange);
- exchange = lookup_exchange (chosen_exchange);
+ exchange = TMH_EXCHANGES_lookup_exchange (chosen_exchange);
if (NULL == exchange)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -1033,7 +1026,7 @@ accept_exchanges (void *cls,
"EXCHANGE_BASE_URL");
return;
}
- exchange = lookup_exchange (url);
+ exchange = TMH_EXCHANGES_lookup_exchange (url);
if (NULL != exchange)
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
@@ -1140,7 +1133,7 @@ update_exchange_keys (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received keys change notification: reload `%s'\n",
url);
- exchange = lookup_exchange (url);
+ exchange = TMH_EXCHANGES_lookup_exchange (url);
GNUNET_break (NULL != exchange);
if (NULL != exchange)
reload_exchange_keys (exchange);
@@ -1185,7 +1178,7 @@ TMH_EXCHANGES_get_limit (
struct TMH_Exchange *exchange;
const struct TALER_EXCHANGE_Keys *keys;
- exchange = lookup_exchange (exchange_url);
+ exchange = TMH_EXCHANGES_lookup_exchange (exchange_url);
if ( (NULL == exchange) ||
(NULL == (keys = exchange->keys)) )
{
diff --git a/src/backend/taler-merchant-httpd_exchanges.h b/src/backend/taler-merchant-httpd_exchanges.h
@@ -152,6 +152,17 @@ TMH_EXCHANGES_get_master_pub (
/**
+ * Lookup exchange by @a exchange_url. Create one
+ * if it does not exist.
+ *
+ * @param exchange_url base URL to match against
+ * @return fresh entry if exchange was not yet known
+ */
+struct TMH_Exchange *
+TMH_EXCHANGES_lookup_exchange (const char *exchange_url);
+
+
+/**
* Return the currency of the given @a exchange.
* Will be returned from configuration for trusted
* exchanges.
diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c
@@ -742,8 +742,10 @@ map_to_status (const struct ExchangeKycRequest *ekr)
static void
ekr_expand_response (struct ExchangeKycRequest *ekr)
{
+ struct TMH_Exchange *e = TMH_EXCHANGES_lookup_exchange (ekr->exchange_url);
const char *status;
+ GNUNET_assert (NULL != e);
status = map_to_status (ekr);
if (NULL == status)
{
@@ -769,6 +771,9 @@ ekr_expand_response (struct ExchangeKycRequest *ekr)
GNUNET_JSON_pack_string (
"exchange_url",
ekr->exchange_url),
+ GNUNET_JSON_pack_string (
+ "exchange_currency",
+ TMH_EXCHANGES_get_currency (e)),
GNUNET_JSON_pack_bool ("no_keys",
ekr->no_keys),
GNUNET_JSON_pack_bool ("auth_conflict",
@@ -1059,6 +1064,9 @@ add_unreachable_status (void *cls,
"h_wire",
uc->h_wire),
GNUNET_JSON_pack_string (
+ "exchange_currency",
+ TMH_EXCHANGES_get_currency (exchange)),
+ GNUNET_JSON_pack_string (
"status",
"exchange-unreachable"),
GNUNET_JSON_pack_string (