lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.73k stars 2.09k forks source link

[bug]: cooperative closure stuck after failed fee negotiation #9224

Open xmrk-btc opened 1 month ago

xmrk-btc commented 1 month ago

Background

I tried to cooperatively close a channel with this command bin/lncli closechannel --sat_per_vbyte 3 --max_fee_rate 5 --delivery_addr bc1ppz3xa7efg3559qjgfw9ufhgt5z0e7yanr5yzgsjagh8cel6e377q248e6y 0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67 4 They start negotiating (see below), but the peer offers rather large fee, so my node ends the negotiation.

2024-10-26 17:59:50.179 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): initiating shutdown
2024-10-26 17:59:56.997 [INF] NANN: Announcing channel(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4) disabled [requested]
2024-10-26 17:59:59.704 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): sending shutdown message
2024-10-26 17:59:59.866 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): shutdown response received, entering fee negotiation
2024-10-26 17:59:59.866 [INF] CHCL: Ideal fee for closure of ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4) is: 450 sat (max_fee=750 sat)
2024-10-26 17:59:59.866 [INF] HSWC: ChannelLink(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): stopping
2024-10-26 17:59:59.879 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): proposing fee of 450 sat to close chan
2024-10-26 17:59:59.879 [INF] HSWC: ChannelLink(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): exited
2024-10-26 17:59:59.942 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): computing fee compromise, ideal=450, last_sent=450, remote_offer=8845
2024-10-26 17:59:59.942 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): proposing fee of 495 sat to close chan
2024-10-26 18:00:00.007 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): computing fee compromise, ideal=450, last_sent=495, remote_offer=7961
2024-10-26 18:00:00.008 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): proposing fee of 544 sat to close chan
2024-10-26 18:00:00.069 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): computing fee compromise, ideal=450, last_sent=544, remote_offer=7165
2024-10-26 18:00:00.070 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): proposing fee of 598 sat to close chan
2024-10-26 18:00:00.129 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): computing fee compromise, ideal=450, last_sent=598, remote_offer=6449
2024-10-26 18:00:00.129 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): proposing fee of 657 sat to close chan
2024-10-26 18:00:00.189 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): computing fee compromise, ideal=450, last_sent=657, remote_offer=5805
2024-10-26 18:00:00.190 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): proposing fee of 722 sat to close chan
2024-10-26 18:00:00.250 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): computing fee compromise, ideal=450, last_sent=722, remote_offer=5225
2024-10-26 18:00:00.250 [ERR] PEER: Peer(020d0fdcc9cfca39aebc7b6fd5657cef4bd5287e571afd6317f0b0a8b4430e3c00): unable to process close msg: latest fee proposal exceeds max fee: 0.00000794 BTC > 0.00000750 BTC
2024-10-26 18:00:00.250 [INF] PEER: Peer(020d0fdcc9cfca39aebc7b6fd5657cef4bd5287e571afd6317f0b0a8b4430e3c00): disconnecting 020d0fdcc9cfca39aebc7b6fd5657cef4bd5287e571afd6317f0b0a8b4430e3c00@159.69.32.62:23252, reason: unable to process close msg: latest fee proposal exceeds max fee: 0.00000794 BTC > 0.00000750 BTC
2024-10-26 18:00:00.250 [ERR] RPCS: [closechannel] unable to close ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): unable to process close msg: latest fee proposal exceeds max fee: 0.00000794 BTC > 0.00000750 BTC
2024-10-26 18:00:00.250 [INF] PEER: Peer(020d0fdcc9cfca39aebc7b6fd5657cef4bd5287e571afd6317f0b0a8b4430e3c00): unable to read message from peer: read next header: read tcp 192.168.1.161:53712->159.69.32.62:23252: use of closed network connection
2024-10-26 18:00:00.250 [ERR] RPCS: [/lnrpc.Lightning/CloseChannel]: unable to process close msg: latest fee proposal exceeds max fee: 0.00000794 BTC > 0.00000750 BTC

When the two nodes connect again, they again try to negotiate, with slightly higher fee, but not enough, so they fail again:

2024-10-26 18:00:02.390 [ERR] PEER: Peer(020d0fdcc9cfca39aebc7b6fd5657cef4bd5287e571afd6317f0b0a8b4430e3c00): unable to process close msg: latest fee proposal exceeds max fee: 0.00000893 BTC > 0.00000864 BTC
2024-10-26 18:00:11.333 [ERR] PEER: Peer(020d0fdcc9cfca39aebc7b6fd5657cef4bd5287e571afd6317f0b0a8b4430e3c00): unable to process close msg: latest fee proposal exceeds max fee: 0.00000893 BTC > 0.00000864 BTC
2024-10-26 18:00:21.793 [ERR] PEER: Peer(020d0fdcc9cfca39aebc7b6fd5657cef4bd5287e571afd6317f0b0a8b4430e3c00): unable to process close msg: latest fee proposal exceeds max fee: 0.00000893 BTC > 0.00000864 BTC
2024-10-26 18:17:41.860 [ERR] PEER: Peer(020d0fdcc9cfca39aebc7b6fd5657cef4bd5287e571afd6317f0b0a8b4430e3c00): unable to process close msg: latest fee proposal exceeds max fee: 0.00000893 BTC > 0.00000864 BTC

Your environment

Expected behaviour

I'd like to change the bounds when the negotiation starts again. Ideally, I would be able to run lncli closechannel again for the same channel, with say --max_fee_rate 10, and the maximum of 10 sats/vB would be used in the next negotiation.

Although I wonder why the peer wants so high fee, whether it is misconfigured.

This happened to me twice today already.

xmrk-btc commented 1 month ago

Both channels were coop closed eventually, so immediate problem is resolved. It happened mostly thanks to peer changing his mind and accepting lower fees, but my node also changed its bounds (now: 288-864 sats, before: 450-750 sats).

2024-10-27 01:13:49.085 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): shutdown response received, entering fee negotiation
2024-10-27 01:13:49.085 [INF] CHCL: Ideal fee for closure of ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4) is: 288 sat (max_fee=864 sat)
2024-10-27 01:13:49.195 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): proposing fee of 288 sat to close chan
2024-10-27 01:13:49.256 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): computing fee compromise, ideal=288, last_sent=288, remote_offer=496
2024-10-27 01:13:49.256 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): proposing fee of 316 sat to close chan
2024-10-27 01:13:49.314 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): computing fee compromise, ideal=288, last_sent=316, remote_offer=447
2024-10-27 01:13:49.314 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4): proposing fee of 347 sat to close chan
2024-10-27 01:13:49.391 [INF] CHCL: ChannelPoint(0f8c769434265108924bf2b48f4cc9ebd113836114477877076aac97e402bb67:4) fee of 0.00000347 BTC accepted, ending negotiation

But still, it took 7 hours to get it resolved, so it could be useful to be able to override maximum accepted by my node (as I wrote previously).

alexbosworth commented 1 month ago

This should be addressed with the upcoming RBF coop close flow right?

saubyk commented 1 month ago

This should get addressed with the upcoming coop close v2, which basically ensures that the peer initiating the channel closure will be paying the closing fee regardless of who initiated the channel open. This will basically cut short the need to negotiate on the fee rate for channel closure.

saubyk commented 1 month ago

relevant prs currently tagged for v0.19: https://github.com/lightningnetwork/lnd/pull/8512 https://github.com/lightningnetwork/lnd/pull/8453