Skip to content

Commit 553899b

Browse files
authored
Merge pull request #9447 from yyforyongyu/yy-sweeper-fix
sweep: start tracking input spending status in the fee bumper
2 parents 09a4d7e + 9f7e2bf commit 553899b

13 files changed

+2205
-502
lines changed

chainntnfs/mempool.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func (m *MempoolNotifier) findRelevantInputs(tx *btcutil.Tx) (inputsWithTx,
211211

212212
// If found, save it to watchedInputs to notify the
213213
// subscriber later.
214-
Log.Infof("Found input %s, spent in %s", op, txid)
214+
Log.Debugf("Found input %s, spent in %s", op, txid)
215215

216216
// Construct the spend details.
217217
details := &SpendDetail{

contractcourt/anchor_resolver.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,21 @@ func (c *anchorResolver) Resolve() (ContractResolver, error) {
9898

9999
select {
100100
case sweepRes := <-c.sweepResultChan:
101-
switch sweepRes.Err {
101+
err := sweepRes.Err
102+
103+
switch {
102104
// Anchor was swept successfully.
103-
case nil:
105+
case err == nil:
104106
sweepTxID := sweepRes.Tx.TxHash()
105107

106108
spendTx = &sweepTxID
107109
outcome = channeldb.ResolverOutcomeClaimed
108110

109111
// Anchor was swept by someone else. This is possible after the
110112
// 16 block csv lock.
111-
case sweep.ErrRemoteSpend:
113+
case errors.Is(err, sweep.ErrRemoteSpend),
114+
errors.Is(err, sweep.ErrInputMissing):
115+
112116
c.log.Warnf("our anchor spent by someone else")
113117
outcome = channeldb.ResolverOutcomeUnclaimed
114118

docs/release-notes/release-notes-0.19.0.md

+5
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,11 @@ The underlying functionality between those two options remain the same.
344344
* A code refactor that [replaces min/max helpers with built-in min/max
345345
functions](https://github.com/lightningnetwork/lnd/pull/9451).
346346

347+
* [Unified](https://github.com/lightningnetwork/lnd/pull/9447) the monitoring
348+
inputs spending logic in the sweeper so it can properly handle missing inputs
349+
and recover from restart.
350+
351+
347352
## Tooling and Documentation
348353

349354
* [Improved `lncli create` command help text](https://github.com/lightningnetwork/lnd/pull/9077)

itest/list_on_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,10 @@ var allTestCases = []*lntest.TestCase{
662662
Name: "invoice migration",
663663
TestFunc: testInvoiceMigration,
664664
},
665+
{
666+
Name: "fee replacement",
667+
TestFunc: testFeeReplacement,
668+
},
665669
}
666670

667671
// appendPrefixed is used to add a prefix to each test name in the subtests

0 commit comments

Comments
 (0)