Skip to content

Commit e33e525

Browse files
committed
staticaddr/withdraw: add retry and reorg handling for withdrawals
This commit fixes three related issues in the withdrawal manager: 1. No retry when RegisterSpendNtfn/RegisterConfirmationsNtfn fails 2. No handling for reorgs (tx confirmed then reorged out) 3. State not persisted before handleWithdrawal, causing recovery failures Changes: - Reorder state persistence to happen BEFORE handleWithdrawal so recoverWithdrawals can find deposits in Withdrawing state on restart - Add retry-on-next-block for registration failures using block notifications - Add reorg detection via lndclient.WithReOrgChan for both spend and confirmation notifications - On reorg after spend detection, return to spend watching (not just re-register for confirmations) since the spend tx may be invalidated - Make handleWithdrawal async/best-effort since tx is already published - Added appropriate tests in manager_test.go Fixes issue #1087 Signed-off-by: kaldun-tech <tsmereka@protonmail.com>
1 parent 62177f9 commit e33e525

3 files changed

Lines changed: 807 additions & 97 deletions

File tree

release_notes.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,13 @@ This file tracks release notes for the loop client.
2020

2121
#### Bug Fixes
2222

23+
* [Static Address Withdrawals: Add retry and reorg handling for withdrawal
24+
confirmations](https://github.com/lightninglabs/loop/issues/1087).
25+
Previously, if `RegisterSpendNtfn` or `RegisterConfirmationsNtfn` failed,
26+
the withdrawal monitoring would silently stop. Additionally, reorgs were not
27+
handled, and state was not persisted before monitoring setup, causing
28+
recovery failures on restart. This fix adds automatic retry on next block
29+
for registration failures, proper reorg detection via `WithReOrgChan`, and
30+
reorders state persistence to occur before monitoring setup.
31+
2332
#### Maintenance

0 commit comments

Comments
 (0)