exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 76ba134c6175b2ea11b80198b6c338d65d3f7be8
parent b3aa1d2455f6abf518018a8bf0a810cb25997305
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  6 Aug 2026 22:56:29 +0200

properly report on commit_or_warn() result

Diffstat:
Msrc/exchange/taler-exchange-drain.c | 25++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/exchange/taler-exchange-drain.c b/src/exchange/taler-exchange-drain.c @@ -374,9 +374,28 @@ run_drain (void *cls) break; } /* commit transaction + report success + exit */ - if (0 >= commit_or_warn ()) - GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, - "Profit drain triggered. Exiting.\n"); + { + enum GNUNET_DB_QueryStatus qs2; + + /* commit_or_warn() returns SUCCESS_NO_RESULTS (0) on a clean commit and + -1/-2 on failure, so the old "0 >= qs" claimed success in every case, + including the one where the drain was rolled back and no prewire row + exists. This line is the entire success signal of a manual operator + tool. */ + qs2 = commit_or_warn (); + if (0 <= qs2) + { + GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, + "Profit drain triggered. Exiting.\n"); + } + else + { + global_ret = EXIT_FAILURE; + GNUNET_log ( + GNUNET_ERROR_TYPE_ERROR, + "Profit drain NOT triggered: transaction failed to commit.\n"); + } + } GNUNET_SCHEDULER_shutdown (); }