Background
My node force-closed an anchor channel while outgoing HTLCs (which were initiated by my node, i.e. not due to forwarding) were pending. The sweeper was instructed accordingly, picking a very low rate as the deadline (refundTimeout) was well in the future at the time of closing the channel:
calculated deadline: 643, using deadlineMinHeight=832898, heightHint=832255
pre-confirmation sweep of anchor of local commit tx xxx:0, force=false
Sweep request received: out_point=xxx:0, witness_type=CommitmentAnchor, relative_time_lock=0, absolute_time_lock=0, amount=0.00000330 BTC, parent=(fee=0.00006491 BTC, weight=2836), params=(fee=643 blocks, force=false, exclusive_group=xxx)
While the channel was in state StateCommitmentBroadcasted (the transaction did not confirm due to fee pressure in the mempool), lnd did NOT adjust the fee rate.
Only after the deadline passed and after I restarted lnd, the sweeper was instructed to use a more aggressive fee rate (deadline 1, force=true):
deadline is passed with deadlineMinHeight=832898, heightHint=833085
calculated deadline: 1, using deadlineMinHeight=832898, heightHint=833085
pre-confirmation sweep of anchor of local commit tx xxx:0, force=true
Sweep request received: out_point=xxx:0, witness_type=CommitmentAnchor, relative_time_lock=0, absolute_time_lock=0, amount=0.00000330 BTC, parent=(fee=0.00006491 BTC, weight=2836), params=(fee=1 blocks, force=true, exclusive_group=xxx)
Your environment
- version of
lnd: v0.17.4-beta
- which operating system (
uname -a on *Nix): Linux server 6.1.0-11-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.38-4 (2023-08-08) x86_64 GNU/Linux
- version of
btcd, bitcoind, or other backend: v25.1.0
Steps to reproduce
- have outgoing HTLCs (in this case: originated from my node, i.e. not forwarded)
- have peer respond with some weird message (a bug on their end), causing the local node to close the channel
- wait
Expected behaviour
The fee rate of the anchor CPFP transaction should gradually increase, so that it confirms before the first HTLC times out.
Actual behaviour
The fee rate was not adjusted. Based on my logs, the advanceState function was not invoked (which logs attempting state step with ..., see https://github.com/lightningnetwork/lnd/blob/v0.17.4-beta/contractcourt/channel_arbitrator.go#L1539).
To me it seems the issue is in channelAttendant, which skips channels in state StateCommitmentBroadcasted so that the (correct?) fee update code triggered in advanceState is not even invoked:
|
// If we're not in the default state, then we can |
|
// ignore this signal as we're waiting for contract |
|
// resolution. |
|
if c.state != StateDefault { |
|
continue |
|
} |
Background
My node force-closed an anchor channel while outgoing HTLCs (which were initiated by my node, i.e. not due to forwarding) were pending. The sweeper was instructed accordingly, picking a very low rate as the deadline (
refundTimeout) was well in the future at the time of closing the channel:While the channel was in state
StateCommitmentBroadcasted(the transaction did not confirm due to fee pressure in the mempool), lnd did NOT adjust the fee rate.Only after the deadline passed and after I restarted lnd, the sweeper was instructed to use a more aggressive fee rate (deadline 1, force=true):
Your environment
lnd: v0.17.4-betauname -aon *Nix): Linux server 6.1.0-11-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.38-4 (2023-08-08) x86_64 GNU/Linuxbtcd,bitcoind, or other backend: v25.1.0Steps to reproduce
Expected behaviour
The fee rate of the anchor CPFP transaction should gradually increase, so that it confirms before the first HTLC times out.
Actual behaviour
The fee rate was not adjusted. Based on my logs, the
advanceStatefunction was not invoked (which logsattempting state step with ..., see https://github.com/lightningnetwork/lnd/blob/v0.17.4-beta/contractcourt/channel_arbitrator.go#L1539).To me it seems the issue is in
channelAttendant, which skips channels in stateStateCommitmentBroadcastedso that the (correct?) fee update code triggered inadvanceStateis not even invoked:lnd/contractcourt/channel_arbitrator.go
Lines 2688 to 2693 in 8bba792