commit c528a4ceda11a6f4c10100b122057d2ee45a7613
parent 6bfcf7f83a654e1346de1446fb71a3b8fa077d31
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 6 Sep 2020 12:50:20 +0200
do not loop if refund fails (#6577)
Diffstat:
1 file 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
@@ -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",