Skip to content

Commit 5cd88f7

Browse files
committed
contractcourt: remove 2xamount requirement for the sweeper.
1 parent a388c1f commit 5cd88f7

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

contractcourt/htlc_timeout_resolver.go

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -465,15 +465,9 @@ func (h *htlcTimeoutResolver) sweepTimeoutTx() error {
465465
}
466466

467467
// Calculate the budget.
468-
//
469-
// TODO(yy): the budget is twice the output's value, which is needed as
470-
// we don't force sweep the output now. To prevent cascading force
471-
// closes, we use all its output value plus a wallet input as the
472-
// budget. This is a temporary solution until we can optionally cancel
473-
// the incoming HTLC, more details in,
474-
// - https://github.com/lightningnetwork/lnd/issues/7969
475468
budget := calculateBudget(
476-
btcutil.Amount(inp.SignDesc().Output.Value), 2, 0,
469+
btcutil.Amount(inp.SignDesc().Output.Value),
470+
h.Budget.DeadlineHTLCRatio, h.Budget.DeadlineHTLC,
477471
)
478472

479473
h.log.Infof("offering 2nd-level HTLC timeout tx to sweeper "+
@@ -535,15 +529,9 @@ func (h *htlcTimeoutResolver) sweepDirectHtlcOutput() error {
535529
)
536530

537531
// Calculate the budget.
538-
//
539-
// TODO(yy): the budget is twice the output's value, which is needed as
540-
// we don't force sweep the output now. To prevent cascading force
541-
// closes, we use all its output value plus a wallet input as the
542-
// budget. This is a temporary solution until we can optionally cancel
543-
// the incoming HTLC, more details in,
544-
// - https://github.com/lightningnetwork/lnd/issues/7969
545532
budget := calculateBudget(
546-
btcutil.Amount(sweepInput.SignDesc().Output.Value), 2, 0,
533+
btcutil.Amount(sweepInput.SignDesc().Output.Value),
534+
h.Budget.DeadlineHTLCRatio, h.Budget.DeadlineHTLC,
547535
)
548536

549537
log.Infof("%T(%x): offering offered remote timeout HTLC output to "+

itest/lnd_sweep_test.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -928,12 +928,7 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
928928
require.Len(ht, outgoingSweep.TxOut, 2)
929929

930930
// Calculate the ending fee rate.
931-
//
932-
// TODO(yy): the budget we use to sweep the first-level outgoing HTLC
933-
// is twice its value. This is a temporary mitigation to prevent
934-
// cascading FCs and the test should be updated once it's properly
935-
// fixed.
936-
outgoingBudget := 2 * invoiceAmt
931+
outgoingBudget := invoiceAmt.MulF64(contractcourt.DefaultBudgetRatio)
937932
outgoingTxSize := ht.CalculateTxWeight(outgoingSweep)
938933
outgoingEndFeeRate := chainfee.NewSatPerKWeight(
939934
outgoingBudget, outgoingTxSize,

0 commit comments

Comments
 (0)