commit 40767e3e2a0cb9f36570bac55e92886f3cbc1009
parent 3225ab7f2dd189bd3a5d756ec7e43b17b75e51a2
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 12 Oct 2026 17:26:56 +0200
preserve to_investigate (if true) and merge properties when applying successor measure
Diffstat:
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/exchangedb/insert_successor_measure.sql b/src/exchangedb/insert_successor_measure.sql
@@ -32,14 +32,22 @@ DECLARE
my_outcome_serial_id INT8;
my_access_token BYTEA;
my_is_wallet BOOL;
+ my_properties JSONB;
+ my_to_investigate BOOL;
BEGIN
out_account_unknown=FALSE;
out_legitimization_measure_serial_id=0;
--- Check no more recent decision exists.
+-- Check no more recent decision exists. Also remember the account
+-- properties and investigation state: expiring rules must not silently
+-- drop what AML staff recorded about the account.
SELECT decision_time
+ ,jproperties
+ ,to_investigate
INTO out_last_date
+ ,my_properties
+ ,my_to_investigate
FROM legitimization_outcomes
WHERE h_payto=in_h_normalized_payto
AND is_active
@@ -128,9 +136,9 @@ INSERT INTO legitimization_outcomes
(in_h_normalized_payto
,in_decision_time
,in_expiration_time
- ,'{}'::JSONB
+ ,COALESCE(my_properties, '{}'::JSONB)
,in_new_measure_name
- ,FALSE
+ ,COALESCE(my_to_investigate, FALSE)
,NULL
)
RETURNING