exchange

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

commit a3f6b0022e857f9c016a76d62590ae9273621c6b
parent 32e1bb04f13ad9e19df9eb34cd86380ae56e51ae
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue,  3 Nov 2026 22:44:31 +0100

do not terminate on fees higer than amounts, but report row inconsistency

Diffstat:
Msrc/auditor/taler-helper-auditor-aggregation.c | 20+++++++++++++++++---
Msrc/auditor/taler-helper-auditor-purses.c | 25++++++++++++++++++++++---
2 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/src/auditor/taler-helper-auditor-aggregation.c b/src/auditor/taler-helper-auditor-aggregation.c @@ -500,9 +500,23 @@ check_transaction_history_for_deposit ( } } deposited = amount_with_fee; - TALER_ARL_amount_subtract (&amount_without_fee, - amount_with_fee, - fee_claimed); + if (TALER_ARL_SR_INVALID_NEGATIVE == + TALER_ARL_amount_subtract_neg (&amount_without_fee, + amount_with_fee, + fee_claimed)) + { + /* The exchange claims a deposit fee that exceeds the deposited + amount; report it (the fee check below will also fire) and + continue with a zero contribution instead of dying here. */ + qs = report_row_inconsistency ("deposits", + tl->serial_id, + "deposit fee exceeds deposited amount"); + if (0 > qs) + return qs; + GNUNET_assert (GNUNET_OK == + TALER_amount_set_zero (TALER_ARL_currency, + &amount_without_fee)); + } TALER_ARL_amount_add (merchant_gain, merchant_gain, &amount_without_fee); diff --git a/src/auditor/taler-helper-auditor-purses.c b/src/auditor/taler-helper-auditor-purses.c @@ -687,9 +687,28 @@ handle_purse_deposits ( } return GNUNET_OK; } - TALER_ARL_amount_subtract (&amount_minus_fee, - &deposit->amount, - &issue->fees.deposit); + if (TALER_ARL_SR_INVALID_NEGATIVE == + TALER_ARL_amount_subtract_neg (&amount_minus_fee, + &deposit->amount, + &issue->fees.deposit)) + { + /* The deposited amount does not even cover the deposit fee of the + denomination; report the bogus row instead of dying here. */ + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Purse deposit `%s' in record %llu is below the deposit fee of its denomination\n", + TALER_B2S (&deposit->purse_pub), + (unsigned long long) rowid); + qs = report_row_inconsistency ("purse-deposit", + rowid, + "deposited amount below deposit fee"); + if (0 > qs) + { + GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs); + pc->qs = qs; + return GNUNET_SYSERR; + } + return GNUNET_OK; + } } if (GNUNET_OK !=