From 5828eead705965b5ac87cfad78636b1363b16396 Mon Sep 17 00:00:00 2001
From: Christian Grothoff <christian@grothoff.org>
Date: Thu, 29 Dec 2022 10:10:11 +0100
Subject: -fix SQL

---
 src/exchangedb/exchange_do_purse_deposit.sql | 13 +++++++++++++
 1 file changed, 13 insertions(+)

(limited to 'src/exchangedb/exchange_do_purse_deposit.sql')

diff --git a/src/exchangedb/exchange_do_purse_deposit.sql b/src/exchangedb/exchange_do_purse_deposit.sql
index 0ca4126af..62fcb3b12 100644
--- a/src/exchangedb/exchange_do_purse_deposit.sql
+++ b/src/exchangedb/exchange_do_purse_deposit.sql
@@ -83,6 +83,19 @@ THEN
 END IF;
 
 
+-- Check if purse was deleted, if so, abort and prevent deposit.
+PERFORM
+  FROM exchange.purse_deletion
+  WHERE purse_pub = in_purse_pub;
+IF FOUND
+THEN
+  out_late=TRUE;
+  out_balance_ok=FALSE;
+  out_conflict=FALSE;
+  RETURN;
+END IF;
+
+
 -- Debit the coin
 -- Check and update balance of the coin.
 UPDATE known_coins
-- 
cgit v1.2.3

