loopdb: persist static loop-in risk decisions

Add schema, sqlc queries, store fields, and SqlStore support for
recording server confirmation-risk decisions with static loop-in swaps.
Store the decision timestamp so payment-deadline recovery can
reconstruct elapsed time after restart.
This commit is contained in:
Slyghtning 2026-07-08 13:57:01 +02:00
parent b0f43bbe1e
commit 491fddbc34
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF
9 changed files with 302 additions and 78 deletions

View file

@ -33,6 +33,22 @@ SET
WHERE
swap_hash = $1;
-- name: RecordStaticAddressRiskDecision :exec
UPDATE static_address_swaps
SET
confirmation_risk_decision = $2,
confirmation_risk_decision_time = CASE
WHEN confirmation_risk_decision = $2 THEN
COALESCE(confirmation_risk_decision_time, $3)
ELSE $3
END
WHERE
swap_hash = $1
AND NOT (
confirmation_risk_decision = 'rejected'
AND $2 = 'accepted'
);
-- name: InsertStaticAddressMetaUpdate :exec
INSERT INTO static_address_swap_updates (
swap_hash,
@ -147,7 +163,3 @@ WHERE
d.swap_hash = $1;