exchange

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

commit c8bc901d6690f3d97d9b991268fcf3ebd0d8a54a
parent fb72b22251d5c8fb4561c4469693b0130a2cd39d
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun,  8 Nov 2026 22:38:02 +0100

properly distinguish gain/loss

Diffstat:
Msrc/auditor/taler-helper-auditor-reserves.c | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c @@ -1620,11 +1620,14 @@ verify_reserve_balance (void *cls, &reserve.balance)) { struct TALER_Amount delta; + bool gain; if (0 < TALER_amount_cmp (&rs->curr_balance.reserve_balance, &reserve.balance)) { - /* balance > reserve.balance */ + /* balance > reserve.balance: the exchange claims to owe + less than we computed, so it made an illegitimate gain */ + gain = true; TALER_ARL_amount_subtract (&delta, &rs->curr_balance.reserve_balance, &reserve.balance); @@ -1637,6 +1640,7 @@ verify_reserve_balance (void *cls, else { /* balance < reserve.balance */ + gain = false; TALER_ARL_amount_subtract (&delta, &reserve.balance, &rs->curr_balance.reserve_balance); @@ -1651,8 +1655,8 @@ verify_reserve_balance (void *cls, struct TALER_AUDITORDB_ReserveBalanceInsufficientInconsistency rbiig = { .reserve_pub = rs->reserve_pub.eddsa_pub, - .inconsistency_amount = nbalance, - .inconsistency_gain = true + .inconsistency_amount = delta, + .inconsistency_gain = gain }; qs = TALER_AUDITORDB_insert_reserve_balance_insufficient_inconsistency