exchange

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

commit b8a241958d73e3f37b01905cc8985fd57384dcc2
parent 611c9160b9b35a28c43972b561bc08a62c3da1fa
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  6 Aug 2026 22:54:02 +0200

fix GC logic

Diffstat:
Msrc/exchangedb/gc.sql | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/exchangedb/gc.sql b/src/exchangedb/gc.sql @@ -50,14 +50,16 @@ DELETE FROM withdraw SELECT reserve_pub FROM reserves WHERE gc_date < in_now - AND current_balance = (0, 0)); + -- The cast is required: taler_amount is (INT8,INT4) and + -- (0,0) is (INT4,INT4), which PostgreSQL would refuse to compare. + AND current_balance = ROW(0,0)::taler_amount); DELETE FROM reserves_close WHERE reserve_pub IN ( SELECT reserve_pub FROM reserves WHERE gc_date < in_now - AND current_balance = (0, 0)); + AND current_balance = ROW(0,0)::taler_amount); SELECT withdraw_id INTO withdraw_min @@ -70,7 +72,7 @@ DELETE FROM recoup DELETE FROM reserves WHERE gc_date < in_now - AND current_balance = (0, 0); + AND current_balance = ROW(0,0)::taler_amount; -- FIXME: this query will be horribly slow; -- need to find another way to formulate it... @@ -121,6 +123,6 @@ SELECT denominations_serial LIMIT 1; DELETE FROM cs_nonce_locks - WHERE max_denomination_serial <= denom_min; + WHERE max_denomination_serial < denom_min; END $$;