diff options
author | Christian Grothoff <christian@grothoff.org> | 2021-10-02 10:05:08 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2021-10-02 10:05:08 +0200 |
commit | 813f0ead6717723b5de9ca00eb0d3d71b33d756d (patch) | |
tree | 9e1f8821d623fab6b3de75b953fcc07256f06d58 | |
parent | 8bb460c42f88e2e9fe9831de86bd1f63e08e547a (diff) |
attempted fix for #7025
-rw-r--r-- | src/backend/taler-merchant-httpd_private-get-orders.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/backend/taler-merchant-httpd_private-get-orders.c b/src/backend/taler-merchant-httpd_private-get-orders.c index e2796610..ba8b47c9 100644 --- a/src/backend/taler-merchant-httpd_private-get-orders.c +++ b/src/backend/taler-merchant-httpd_private-get-orders.c @@ -294,9 +294,9 @@ add_order (void *cls, po->result = TALER_EC_GENERIC_DB_FETCH_FAILED; return; } - /* qs == 0: contract terms don't exist, so the order cannot be paid. */ if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) { + /* Contract terms don't exist, so the order cannot be paid. */ paid = false; if (NULL == orig_order_id) { @@ -309,10 +309,8 @@ add_order (void *cls, order_id = GNUNET_strdup (orig_order_id); } - if (paid) { - /* if the order was paid, it must have been claimed, so use - lookup_contract_terms to avoid the order being deleted in the db. */ + /* First try to find the order in the contracts */ uint64_t os; qs = TMH_db->lookup_contract_terms (TMH_db->cls, @@ -322,8 +320,9 @@ add_order (void *cls, &os, NULL); } - else + if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) { + /* Might still be unclaimed, so try order table */ struct GNUNET_HashCode unused; qs = TMH_db->lookup_order (TMH_db->cls, @@ -333,10 +332,9 @@ add_order (void *cls, &unused, &contract_terms); } - if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs) { - GNUNET_break (0); + GNUNET_break (0); /* Failed: #7025 */ po->result = TALER_EC_GENERIC_DB_FETCH_FAILED; json_decref (contract_terms); GNUNET_free (order_id); @@ -770,6 +768,7 @@ TMH_private_get_orders (const struct TMH_RequestHandler *rh, po); if (0 > qs) { + GNUNET_break (0); po->result = TALER_EC_GENERIC_DB_FETCH_FAILED; } if (TALER_EC_NONE != po->result) |