[bug]: contractcourt: max budget used immediately for anchor sweeps #8738
Labels
bug
Unintended code behaviour
contracts
fees
Related to the fees paid for transactions (both LN and funding/commitment transactions)
utxo sweeping
Milestone
For outgoing HTLCs the commitment deadline is calculated incorrectly, causing the entire anchor budget to be spent immediately.
Problem
The commitment deadline is derived from the timelocks of the outgoing HTLCs, instead of the timelocks for the matching upstream (incoming) HTLCs.
lnd/contractcourt/channel_arbitrator.go
Lines 1452 to 1480 in c68778d
Since
ChannelArbitrator
only broadcast commitments for outgoing HTLCs once the timelock has already expired, the resulting deadline for anchor sweeping is always 0 (which is bumped to 1). This causes the sweeper to spend the entire budget immediately.Solution
The upstream HTLC timelocks need to be used for the deadline instead.
The text was updated successfully, but these errors were encountered: