[bug]: sweep: LinearFeeFunction off by one #8741
Labels
bug
Unintended code behaviour
fees
Related to the fees paid for transactions (both LN and funding/commitment transactions)
P1
MUST be fixed or reviewed
utxo sweeping
Milestone
LinearFeeFunction
doesn't return the max fee rate until after the deadline has been missed.Example
Current block height is
H
. An incoming HTLC has acltv_expiry
ofH + 10
, so the contractcourt setsdeadline := H + 10
for the HTLC input.We need to confirm our HTLC-Preimage no later than block
H + 10
, or else we'll get into a bidding war with the channel peer since they can spend the timeout path after blockH + 10
confirms.LinearFeeFunction
should max out its fee rate after blockH + 9
confirms since this is the last shot at meeting the deadline. Instead,LinearFeeFunction
waits to max out the fee rate until blockH + 10
.Severity
For typical deadlines 10+ blocks away, this is a minor problem. But in the extreme case of a next-block deadline,
LinearFeeFunction
will return the min feerate instead of the max, which is quite bad.The text was updated successfully, but these errors were encountered: