staticaddr: cancel loop-ins when deposit inputs vanish

Keep replacement UTXOs as fresh deposits while preserving the original deposit
record and selected outpoint snapshot for pending swaps.

Before signing a static loop-in HTLC, check each original selected outpoint with
GetTxOut(..., includeMempool=true). Cancel the pending invoice only when that
check reports an original outpoint unavailable; lookup errors fail the action
without canceling so transient chain backend errors do not incorrectly abandon
the swap.

Keep recovered loop-ins using their stored outpoint snapshot and cover
replacement discovery and cancellation in tests.
This commit is contained in:
Slyghtning 2026-04-22 14:49:35 +02:00
parent 6d70f0fe47
commit 858066dd0c
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF
13 changed files with 509 additions and 35 deletions

View file

@ -700,6 +700,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error {
Store: staticAddressLoopInStore,
WalletKit: d.lnd.WalletKit,
ChainNotifier: d.lnd.ChainNotifier,
TxOutChecker: loopin.NewLndTxOutChecker(d.lnd.Client),
NotificationManager: notificationManager,
ChainParams: d.lnd.ChainParams,
Signer: d.lnd.Signer,