exchange

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

commit f73b866c9617f57278ea306cd3ef5a856ec0b645
parent f0e1066993324b2cdecd9f8ed16b8b1a074ab4a0
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun,  6 Apr 2025 15:07:48 +0200

fix SQL bug found by Oezguer

Diffstat:
Msrc/exchangedb/exchange_do_batch_withdraw_insert.sql | 2+-
Msrc/exchangedb/exchange_do_melt.sql | 8++++----
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/exchangedb/exchange_do_batch_withdraw_insert.sql b/src/exchangedb/exchange_do_batch_withdraw_insert.sql @@ -84,7 +84,7 @@ out_conflict=FALSE; -- Special actions needed for a CS withdraw? out_nonce_reuse=FALSE; -IF NOT NULL cs_nonce +IF cs_nonce IS NOT NULL THEN -- Cache CS signature to prevent replays in the future -- (and check if cached signature exists at the same time). diff --git a/src/exchangedb/exchange_do_melt.sql b/src/exchangedb/exchange_do_melt.sql @@ -131,7 +131,7 @@ END IF; -- Special actions needed for a CS melt? -IF NOT NULL in_cs_rms +IF in_cs_rms IS NOT NULL THEN -- Get maximum denominations serial value in -- existence, this will determine how long the @@ -151,8 +151,8 @@ THEN ,max_denomination_serial ,op_hash) VALUES - (cs_rms - ,denom_serial + (in_cs_rms + ,denom_max ,in_rc) ON CONFLICT DO NOTHING; @@ -161,7 +161,7 @@ THEN -- Record exists, make sure it is the same SELECT 1 FROM exchange.cs_nonce_locks - WHERE nonce=cs_rms + WHERE nonce=in_cs_rms AND op_hash=in_rc; IF NOT FOUND