[bug]: RBF coop close: without a fee estimate, the peer that did not close pays the whole close fee at 25 sat/vB

Open
#11,381 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
49/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
backend, payments

Research direction

Start with lnwallet/chancloser/rbf_coop_transitions.go, especially ChannelFlushing, and trace how the responder selects and sends its fee offer when IdealFeeRate is unavailable. Check the default rate in chainreg/chainregistry.go and review related issues #9827 and #9829. Done means the non-closing peer’s fee behavior matches an agreed policy, including the reported low-balance and no-estimate cases, with regression coverage.

Written by the indexing model from the issue text.

Description

bug needs triage
Pre-Submission Checklist
  • I have searched the existing issues and believe this is a new bug.
  • I am not asking a question about how to use lnd, but reporting a bug (otherwise open a discussion).
LND Version

v0.21.4-beta

LND Configuration

Close and fee related settings on the two Signet nodes where it was first seen:

[protocol]
protocol.simple-taproot-chans=true
protocol.rbf-coop-close=true

No coop-close-target-confs, no fee.url, no bitcoind.estimatemode. Reproduced on regtest with only protocol.simple-taproot-chans=true: LND turns RBF close on by itself when taproot channels are on.

Backend Version

Bitcoin Core v31.1.0

Backend Configuration

Signet nodes, bitcoind on the same host (credentials removed):

server=1
disablewallet=1
signet=1
prune=25000
maxmempool=300
proxy=127.0.0.1:9050
listen=1
listenonion=1
zmqpubrawblock=tcp://127.0.0.1:<port>
zmqpubrawtx=tcp://127.0.0.1:<port>

At the time of the close bitcoind had no fee estimate yet (lnd logged "fee estimation data not available yet"). Regtest: a fresh chain, so estimatesmartfee returned "Insufficient data or no feerate found".

OS/Distribution

Linux amd64 (regtest). First seen on two Debian 13 amd64 Signet nodes, packaged by Virtual Private Node (github.com/virtpriv/node).

Bug Details & Steps to Reproduce

Node A closes a channel cooperatively. B, its peer, does nothing. B's lnd still sends its own closing_complete at its default fee rate. Without a fee estimate that is lnd's fixed 25 sat/vB. B's version pays more, so it is mined, and B pays the whole close fee although A started the close.

Steps (regtest, Bitcoin Core 31.1, two lnd 0.21.4-beta):

  1. A opens a private 25,000 sat taproot channel to B and pays B some sats by keysend.
  2. A runs lncli closechannel --sat_per_vbyte 2. B does nothing.
  3. Mine a block and compare.

A offered 2 sat/vB (307 sats), B offered 25 sat/vB (3,843 sats):

B's balance Mined B gets
3,800 A's version. B skips its offer: "unable to pay fees with local balance" 3,800
4,000 B's version. B's remaining 157 sats are below dust, so its output is dropped 0
15,000 B's version 11,157

So without an estimate B pays whenever it can, and a balance just above its fee (here 3,843 to 4,172 sats) is lost whole. The same happens on an anchors channel. With real fee estimates B pays when its 6 block estimate is at least the closer's fee, so a closer can pick a very low fee on purpose to make its peer pay.

First seen on Signet: B held 4,000 sats, A closed at 2 sat/vB, B received nothing.

I understand both sides SHOULD send closing_complete (BOLT 2) and each pays for its own version. The surprise is that the peer that did not ask to close pays a fee it never chose. The 0.19 announcement says "the peer who closes the channel will also be responsible for the on-chain channel close transaction fees". A cooperative close is not time sensitive (BOLT 2: "there is usually no reason to pay a high fee"), so lnd's general 25 sat/vB safety fallback seems out of place for an offer the peer did not ask to make.

Code: lnwallet/chancloser/rbf_coop_transitions.go, ChannelFlushing: with no IdealFeeRate the responder uses env.DefaultFeeRate and sends its offer whenever LocalCanPayFees. The 25 sat/vB fallback is in chainreg/chainregistry.go.

Related: #9827, #9829.

Expected Behavior

The peer that did not start the close should not end up paying a fee it never chose. All of these stay within BOLT 2, since sending closing_complete is a SHOULD and each node chooses its own fee:

  1. Smaller change: cap the non-closing peer's own offer at a configurable maximum, and use a low rate instead of the 25 sat/vB fallback when there is no estimate (Eclair does this, max-closing-feerate).
  2. Fuller change: the non-closing peer offers no more than the closer's fee rate (or makes no offer at all unless asked), and skips its offer when it has no estimate. The closer then pays, as the 0.19 announcement describes, and the peer can still bump with lncli closechannel if it wants a faster close.
  3. With either: skip the non-closing peer's offer when its own output would fall below dust (the 4,000 row), as lnd already skips an offer it cannot pay (the 3,800 row). This alone stops a balance from being lost whole.

If the current behaviour is intended, a line in the docs saying the non-closing peer may pay would help.

Debug Information

Regtest, B's balance 4,000, channel points removed:

A: CHCL: using ideal_fee=2 sat/vb, absolute_fee=0.00000307 BTC
B: CHCL: using ideal_fee=25 sat/vb, absolute_fee=0.00003843 BTC
A: PFSM: unable to broadcast txn: insufficient fee
A closedchannels: settled_balance 21000, close_initiator INITIATOR_BOTH
B closedchannels: settled_balance 0, close_initiator INITIATOR_BOTH

B's balance 3,800:

B: CHCL: using ideal_fee=25 sat/vb, absolute_fee=0.00003843 BTC
B: CHCL: unable to pay fees with local balance, skipping closing_complete
Environment

No response

Dominant language
Go
Stars
8.2k
Forks
2.3k
Avg merge
1d 11h
Merged PRs (30d)
103

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from lightningnetwork/lnd

All issues in lightningnetwork/lnd

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.