Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sweep: start tracking input spending status in the fee bumper #9447

Merged
merged 19 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chainntnfs/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ func (m *MempoolNotifier) findRelevantInputs(tx *btcutil.Tx) (inputsWithTx,

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

// Construct the spend details.
details := &SpendDetail{
Expand Down
10 changes: 7 additions & 3 deletions contractcourt/anchor_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,21 @@ func (c *anchorResolver) Resolve() (ContractResolver, error) {

select {
case sweepRes := <-c.sweepResultChan:
switch sweepRes.Err {
err := sweepRes.Err

switch {
// Anchor was swept successfully.
case nil:
case err == nil:
sweepTxID := sweepRes.Tx.TxHash()

spendTx = &sweepTxID
outcome = channeldb.ResolverOutcomeClaimed

// Anchor was swept by someone else. This is possible after the
// 16 block csv lock.
case sweep.ErrRemoteSpend:
case errors.Is(err, sweep.ErrRemoteSpend),
errors.Is(err, sweep.ErrInputMissing):

c.log.Warnf("our anchor spent by someone else")
outcome = channeldb.ResolverOutcomeUnclaimed

Expand Down
5 changes: 5 additions & 0 deletions docs/release-notes/release-notes-0.19.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ The underlying functionality between those two options remain the same.
* A code refactor that [replaces min/max helpers with built-in min/max
functions](https://github.com/lightningnetwork/lnd/pull/9451).

* [Unified](https://github.com/lightningnetwork/lnd/pull/9447) the monitoring
inputs spending logic in the sweeper so it can properly handle missing inputs
and recover from restart.


## Tooling and Documentation

* [Improved `lncli create` command help text](https://github.com/lightningnetwork/lnd/pull/9077)
Expand Down
4 changes: 4 additions & 0 deletions itest/list_on_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,10 @@ var allTestCases = []*lntest.TestCase{
Name: "invoice migration",
TestFunc: testInvoiceMigration,
},
{
Name: "fee replacement",
TestFunc: testFeeReplacement,
},
}

// appendPrefixed is used to add a prefix to each test name in the subtests
Expand Down
Loading
Loading