mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-25 08:11:18 +02:00
Merge pull request #9274 from ziggie1984/remove-2x-value
The sweeper subsystem uses now also the configured budget values for HTLCs
This commit is contained in:
commit
e9dd01b60d
@ -465,15 +465,9 @@ func (h *htlcTimeoutResolver) sweepTimeoutTx() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the budget.
|
// Calculate the budget.
|
||||||
//
|
|
||||||
// TODO(yy): the budget is twice the output's value, which is needed as
|
|
||||||
// we don't force sweep the output now. To prevent cascading force
|
|
||||||
// closes, we use all its output value plus a wallet input as the
|
|
||||||
// budget. This is a temporary solution until we can optionally cancel
|
|
||||||
// the incoming HTLC, more details in,
|
|
||||||
// - https://github.com/lightningnetwork/lnd/issues/7969
|
|
||||||
budget := calculateBudget(
|
budget := calculateBudget(
|
||||||
btcutil.Amount(inp.SignDesc().Output.Value), 2, 0,
|
btcutil.Amount(inp.SignDesc().Output.Value),
|
||||||
|
h.Budget.DeadlineHTLCRatio, h.Budget.DeadlineHTLC,
|
||||||
)
|
)
|
||||||
|
|
||||||
h.log.Infof("offering 2nd-level HTLC timeout tx to sweeper "+
|
h.log.Infof("offering 2nd-level HTLC timeout tx to sweeper "+
|
||||||
@ -535,15 +529,9 @@ func (h *htlcTimeoutResolver) sweepDirectHtlcOutput() error {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Calculate the budget.
|
// Calculate the budget.
|
||||||
//
|
|
||||||
// TODO(yy): the budget is twice the output's value, which is needed as
|
|
||||||
// we don't force sweep the output now. To prevent cascading force
|
|
||||||
// closes, we use all its output value plus a wallet input as the
|
|
||||||
// budget. This is a temporary solution until we can optionally cancel
|
|
||||||
// the incoming HTLC, more details in,
|
|
||||||
// - https://github.com/lightningnetwork/lnd/issues/7969
|
|
||||||
budget := calculateBudget(
|
budget := calculateBudget(
|
||||||
btcutil.Amount(sweepInput.SignDesc().Output.Value), 2, 0,
|
btcutil.Amount(sweepInput.SignDesc().Output.Value),
|
||||||
|
h.Budget.DeadlineHTLCRatio, h.Budget.DeadlineHTLC,
|
||||||
)
|
)
|
||||||
|
|
||||||
log.Infof("%T(%x): offering offered remote timeout HTLC output to "+
|
log.Infof("%T(%x): offering offered remote timeout HTLC output to "+
|
||||||
|
@ -136,6 +136,10 @@
|
|||||||
[here](https://github.com/lightningnetwork/lnd/blob/master/chainio/README.md)
|
[here](https://github.com/lightningnetwork/lnd/blob/master/chainio/README.md)
|
||||||
to learn more.
|
to learn more.
|
||||||
|
|
||||||
|
* [The sweeper](https://github.com/lightningnetwork/lnd/pull/9274) does now also
|
||||||
|
use the configured budget values for HTLCs (first level sweep) in parcticular
|
||||||
|
`--sweeper.budget.deadlinehtlcratio` and `--sweeper.budget.deadlinehtlc`.
|
||||||
|
|
||||||
## RPC Updates
|
## RPC Updates
|
||||||
|
|
||||||
* Some RPCs that previously just returned an empty response message now at least
|
* Some RPCs that previously just returned an empty response message now at least
|
||||||
|
@ -928,12 +928,7 @@ func testSweepHTLCs(ht *lntest.HarnessTest) {
|
|||||||
require.Len(ht, outgoingSweep.TxOut, 2)
|
require.Len(ht, outgoingSweep.TxOut, 2)
|
||||||
|
|
||||||
// Calculate the ending fee rate.
|
// Calculate the ending fee rate.
|
||||||
//
|
outgoingBudget := invoiceAmt.MulF64(contractcourt.DefaultBudgetRatio)
|
||||||
// TODO(yy): the budget we use to sweep the first-level outgoing HTLC
|
|
||||||
// is twice its value. This is a temporary mitigation to prevent
|
|
||||||
// cascading FCs and the test should be updated once it's properly
|
|
||||||
// fixed.
|
|
||||||
outgoingBudget := 2 * invoiceAmt
|
|
||||||
outgoingTxSize := ht.CalculateTxWeight(outgoingSweep)
|
outgoingTxSize := ht.CalculateTxWeight(outgoingSweep)
|
||||||
outgoingEndFeeRate := chainfee.NewSatPerKWeight(
|
outgoingEndFeeRate := chainfee.NewSatPerKWeight(
|
||||||
outgoingBudget, outgoingTxSize,
|
outgoingBudget, outgoingTxSize,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user