summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-09-06 12:50:20 +0200
committerChristian Grothoff <christian@grothoff.org>2020-09-06 12:50:33 +0200
commitc528a4ceda11a6f4c10100b122057d2ee45a7613 (patch)
tree47b044942d8662835635c5c89d844604781d662e /src
parent6bfcf7f83a654e1346de1446fb71a3b8fa077d31 (diff)
downloadmerchant-c528a4ceda11a6f4c10100b122057d2ee45a7613.tar.gz
merchant-c528a4ceda11a6f4c10100b122057d2ee45a7613.tar.bz2
merchant-c528a4ceda11a6f4c10100b122057d2ee45a7613.zip
do not loop if refund fails (#6577)
Diffstat (limited to 'src')
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-refund.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
index 18fca9ac..31d0a86c 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-refund.c
@@ -436,6 +436,13 @@ process_refunds_cb (void *cls,
struct PostRefundData *prd = cls;
struct CoinRefund *cr;
+ for (cr = prd->cr_head;
+ NULL != cr;
+ cr = cr->next)
+ if (cr->refund_serial == refund_serial)
+ return;
+ /* already known */
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Found refund of %s for coin %s with reason `%s' in database\n",
TALER_amount2s (refund_amount),
@@ -598,17 +605,20 @@ TMH_post_orders_ID_refund (const struct TMH_RequestHandler *rh,
TALER_EC_GET_ORDERS_DB_LOOKUP_ERROR,
NULL);
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- /* We need to talk to the exchange */
- /* Notify clients waiting for the refund to be obtained. */
- TMH_long_poll_resume (hc->infix,
- hc->instance,
- &prd->refund_amount,
- true);
- cr->fo = TMH_EXCHANGES_find_exchange (cr->exchange_url,
- NULL,
- GNUNET_NO,
- &exchange_found_cb,
- cr);
+ if (NULL == cr->exchange_reply)
+ {
+ /* We need to talk to the exchange */
+ /* Notify clients waiting for the refund to be obtained. */
+ TMH_long_poll_resume (hc->infix,
+ hc->instance,
+ &prd->refund_amount,
+ true);
+ cr->fo = TMH_EXCHANGES_find_exchange (cr->exchange_url,
+ NULL,
+ GNUNET_NO,
+ &exchange_found_cb,
+ cr);
+ }
break;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
/* We got a reply earlier, set status accordingly */
@@ -646,7 +656,7 @@ TMH_post_orders_ID_refund (const struct TMH_RequestHandler *rh,
{
if (NULL == cr->exchange_reply)
{
- refund = json_pack ("{s:s, s:I,s:I,s:o,s:o,s:o}"
+ refund = json_pack ("{s:s,s:I,s:I,s:o,s:o,s:o}"
"type",
"failure",
"exchange_status",