Skip to content

Commit 15dbc43

Browse files
authored
Merge pull request #9627 from yyforyongyu/sweep-under-budget
Sweep inputs even the budget cannot be covered
2 parents 193d2a6 + ec2f3ad commit 15dbc43

14 files changed

+697
-199
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ close transaction.
162162
tests to set a lower value for faster funding confirmation timeout while
163163
keeping the default of 2016 blocks for production stability.
164164

165+
* Previously when sweeping inputs, the sweeper will wait until the specified
166+
budget can be covered by the inputs, which could cause the sweep to be
167+
delayed, and the sweeping tx ends up using large fees. This is now
168+
[changed](https://github.com/lightningnetwork/lnd/pull/9627) so the sweeper
169+
will always attempt the sweep as long as the budget can be partially covered.
170+
165171
## RPC Additions
166172

167173
* [Add a new rpc endpoint](https://github.com/lightningnetwork/lnd/pull/8843)

itest/list_on_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,10 @@ var allTestCases = []*lntest.TestCase{
690690
Name: "rbf coop close",
691691
TestFunc: testCoopCloseRbf,
692692
},
693+
{
694+
Name: "bump fee low budget",
695+
TestFunc: testBumpFeeLowBudget,
696+
},
693697
}
694698

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

itest/lnd_funding_test.go

+13-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/btcsuite/btcd/btcutil"
99
"github.com/btcsuite/btcd/chaincfg/chainhash"
1010
"github.com/btcsuite/btcd/txscript"
11+
"github.com/btcsuite/btcd/wire"
1112
"github.com/lightningnetwork/lnd/chainreg"
1213
"github.com/lightningnetwork/lnd/funding"
1314
"github.com/lightningnetwork/lnd/labels"
@@ -466,20 +467,29 @@ func runChannelFundingInputTypes(ht *lntest.HarnessTest, alice,
466467
burnAddr = "bcrt1qxsnqpdc842lu8c0xlllgvejt6rhy49u6fmpgyz"
467468
)
468469

469-
fundMixed := func(amt btcutil.Amount, target *node.HarnessNode) {
470+
fundMixed := func(amt btcutil.Amount,
471+
target *node.HarnessNode) *wire.MsgTx {
472+
470473
ht.FundCoins(amt/5, target)
471474
ht.FundCoins(amt/5, target)
472475
ht.FundCoinsP2TR(amt/5, target)
473476
ht.FundCoinsP2TR(amt/5, target)
474477
ht.FundCoinsP2TR(amt/5, target)
478+
479+
return nil
475480
}
476-
fundMultipleP2TR := func(amt btcutil.Amount, target *node.HarnessNode) {
481+
fundMultipleP2TR := func(amt btcutil.Amount,
482+
target *node.HarnessNode) *wire.MsgTx {
483+
477484
ht.FundCoinsP2TR(amt/4, target)
478485
ht.FundCoinsP2TR(amt/4, target)
479486
ht.FundCoinsP2TR(amt/4, target)
480487
ht.FundCoinsP2TR(amt/4, target)
488+
489+
return nil
481490
}
482-
fundWithTypes := []func(amt btcutil.Amount, target *node.HarnessNode){
491+
fundWithTypes := []func(amt btcutil.Amount,
492+
target *node.HarnessNode) *wire.MsgTx{
483493
ht.FundCoins, ht.FundCoinsNP2WKH, ht.FundCoinsP2TR, fundMixed,
484494
fundMultipleP2TR,
485495
}

itest/lnd_multi-hop_force_close_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2570,7 +2570,7 @@ func runLocalPreimageClaimLeased(ht *lntest.HarnessTest,
25702570
// We'll now mine enough blocks so Carol decides that she needs to go
25712571
// on-chain to claim the HTLC as Bob has been inactive.
25722572
numBlocks := padCLTV(
2573-
invoiceExpiry - ht.CurrentHeight() - incomingBroadcastDelta - 1,
2573+
invoiceExpiry - ht.CurrentHeight() - incomingBroadcastDelta,
25742574
)
25752575
ht.MineBlocks(int(numBlocks))
25762576

0 commit comments

Comments
 (0)