merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 42d7f169a2dba33f5fcc667527933e93183fd07f
parent 4ce9fb07e98f445c9c97460e780d8c15ca3e1060
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun,  5 Jul 2026 23:34:35 +0200

add missing transaction failure handling to PATCH /instances/

Diffstat:
Msrc/backend/taler-merchant-httpd_patch-management-instances-INSTANCE.c | 21++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_patch-management-instances-INSTANCE.c b/src/backend/taler-merchant-httpd_patch-management-instances-INSTANCE.c @@ -428,19 +428,30 @@ patch_instances_ID (struct TMH_MerchantInstance *mi, if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs) { TALER_MERCHANTDB_rollback (TMH_db); - if (GNUNET_DB_STATUS_SOFT_ERROR == qs) - goto retry; - else - goto giveup; + goto retry; } } qs = TALER_MERCHANTDB_commit (TMH_db); + if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs) + qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; retry: if (GNUNET_DB_STATUS_SOFT_ERROR == qs) continue; break; } /* for(... MAX_RETRIES) */ -giveup: + if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs) + { + /* Hard error or retries exhausted: the transaction did not + commit, so do NOT mutate our in-memory settings and report + the failure to the client. */ + GNUNET_break (0); + GNUNET_JSON_parse_free (spec); + GNUNET_free (is.phone); + return TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_COMMIT_FAILED, + NULL); + } /* Update our 'settings' */ GNUNET_free (mi->settings.name); GNUNET_free (mi->settings.email);