commit 07008e3fb05a44d993436bb9533869b64674dbd5
parent bc3313b8a734bb335b55c30a56be4e59c50f5812
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 9 May 2025 13:53:22 +0200
get exchange_do_main_gc.sql to work again
Diffstat:
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/src/exchangedb/exchange_do_main_gc.sql b/src/exchangedb/exchange_do_main_gc.sql
@@ -1,6 +1,6 @@
--
-- This file is part of TALER
--- Copyright (C) 2014--2022 Taler Systems SA
+-- Copyright (C) 2014--2025 Taler Systems SA
--
-- TALER is free software; you can redistribute it and/or modify it under the
-- terms of the GNU General Public License as published by the Free Software
@@ -21,7 +21,6 @@ LANGUAGE plpgsql
AS $$
DECLARE
reserve_uuid_min INT8; -- minimum reserve UUID still alive
- melt_min INT8; -- minimum melt still alive
coin_min INT8; -- minimum known_coin still alive
batch_deposit_min INT8; -- minimum deposit still alive
withdraw_min INT8; -- minimum withdraw still alive
@@ -34,6 +33,18 @@ DELETE FROM prewire
DELETE FROM wire_fee
WHERE end_date < in_ancient_date;
+DELETE FROM refresh
+ WHERE execution_date < in_ancient_date;
+
+DELETE FROM kycauths_in
+ WHERE execution_date < in_ancient_date;
+
+DELETE FROM reserves_in
+ WHERE execution_date < in_ancient_date;
+
+DELETE FROM batch_deposits
+ WHERE wire_deadline < in_ancient_date;
+
-- FIXME: use closing fee as threshold?
DELETE FROM reserves
WHERE gc_date < in_now
@@ -77,17 +88,8 @@ DELETE FROM denominations
(SELECT DISTINCT coin_pub
FROM recoup_refresh));
-SELECT melt_serial_id
- INTO melt_min
- FROM refresh_commitments
- ORDER BY melt_serial_id ASC
- LIMIT 1;
-
-DELETE FROM refresh_revealed_coins
- WHERE melt_serial_id < melt_min;
-
-DELETE FROM refresh_transfer_keys
- WHERE melt_serial_id < melt_min;
+DELETE FROM recoup_refresh
+ WHERE known_coin_id < coin_min;
SELECT known_coin_id
INTO coin_min
@@ -95,12 +97,6 @@ SELECT known_coin_id
ORDER BY known_coin_id ASC
LIMIT 1;
-DELETE FROM recoup_refresh
- WHERE known_coin_id < coin_min;
-
-DELETE FROM batch_deposits
- WHERE wire_deadline < in_ancient_date;
-
SELECT batch_deposit_serial_id
INTO batch_deposit_min
FROM coin_deposits