exchange

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

commit 26a20dafcb36935e4d2eb362c1da3ee066fd4899
parent 7041226ef17c846080b0dd95dc825602c0b4928b
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Mon, 17 Aug 2026 15:13:09 +0200

fix purse balance accounting

Diffstat:
Msrc/auditor/taler-helper-auditor-purses.c | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/auditor/taler-helper-auditor-purses.c b/src/auditor/taler-helper-auditor-purses.c @@ -1116,6 +1116,21 @@ handle_purse_decision ( GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting purse with decision `%s'\n", TALER_B2S (&ps->purse_pub)); + /* The purse ceases to exist, so the money it held is no longer + part of the balance the exchange holds in open purses. */ + if (0 > + TALER_amount_subtract (&TALER_ARL_USE_AB (purse_global_balance), + &TALER_ARL_USE_AB (purse_global_balance), + &ps->balance)) + { + /* Should be impossible: we added this balance to the global + balance when we learned about it. */ + GNUNET_break (0); + GNUNET_assert (GNUNET_OK == + TALER_amount_set_zero (TALER_ARL_currency, + &TALER_ARL_USE_AB ( + purse_global_balance))); + } qs = TALER_AUDITORDB_delete_purse_info (TALER_ARL_adb, purse_pub); if (qs < 0)