From b671d6b25dd469c9065a28d4406f6883da83c4ea Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 24 Apr 2022 16:02:34 +0200 Subject: [PATCH] get first p2p test to pass --- src/exchange/taler-exchange-httpd_purses_create.c | 2 +- src/exchange/taler-exchange-httpd_purses_merge.c | 11 +++++++---- src/lib/exchange_api_purse_merge.c | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/exchange/taler-exchange-httpd_purses_create.c b/src/exchange/taler-exchange-httpd_purses_create.c index ef1189530..acd9bcc55 100644 --- a/src/exchange/taler-exchange-httpd_purses_create.c +++ b/src/exchange/taler-exchange-httpd_purses_create.c @@ -492,7 +492,7 @@ parse_coin (struct MHD_Connection *connection, if (GNUNET_OK != TALER_wallet_purse_deposit_verify (TEH_base_url, pcc->purse_pub, - &pcc->amount, + &coin->amount, &coin->cpi.coin_pub, &coin->coin_sig)) { diff --git a/src/exchange/taler-exchange-httpd_purses_merge.c b/src/exchange/taler-exchange-httpd_purses_merge.c index ee8a73756..e79c41d85 100644 --- a/src/exchange/taler-exchange-httpd_purses_merge.c +++ b/src/exchange/taler-exchange-httpd_purses_merge.c @@ -134,7 +134,7 @@ reply_merge_success (struct MHD_Connection *connection, enum TALER_ErrorCode ec; struct TALER_Amount merge_amount; - if (0 <= + if (0 < TALER_amount_cmp (&pcc->balance, &pcc->target_amount)) { @@ -144,8 +144,9 @@ reply_merge_success (struct MHD_Connection *connection, TALER_JSON_pack_amount ("balance", &pcc->balance)); } - if (0 == strcmp (pcc->provider_url, - TEH_base_url)) + if ( (NULL == pcc->provider_url) || + (0 == strcmp (pcc->provider_url, + TEH_base_url)) ) { /* wad fee is always zero if we stay at our own exchange */ merge_amount = pcc->target_amount; @@ -175,7 +176,9 @@ reply_merge_success (struct MHD_Connection *connection, pcc->purse_pub, &pcc->h_contract_terms, &pcc->reserve_pub, - pcc->provider_url, + (NULL != pcc->provider_url) + ? pcc->provider_url + : TEH_base_url, &pub, &sig))) { diff --git a/src/lib/exchange_api_purse_merge.c b/src/lib/exchange_api_purse_merge.c index 2dc9e4ca0..d30d5da26 100644 --- a/src/lib/exchange_api_purse_merge.c +++ b/src/lib/exchange_api_purse_merge.c @@ -142,7 +142,7 @@ handle_purse_merge_finished (void *cls, &exchange_pub), GNUNET_JSON_spec_timestamp ("exchange_timestamp", &etime), - TALER_JSON_spec_amount ("total_deposited", + TALER_JSON_spec_amount ("merge_amount", pch->purse_value_after_fees.currency, &total_deposited), GNUNET_JSON_spec_end ()