BOLT 2 requires the receiver of open_channel to fail the channel when the funder's amount cannot cover the initial commitment fee:
The receiving node MUST fail the channel if:
- the funder's amount for the initial commitment transaction is not sufficient for full [fee payment](03-transactions.md#fee-payment).
Eclair implements the rule, but too late. The channel isn't rejected until later in the flow, after receiving funding_created.
Impact
A peer can set a push_msat for the channel that leaves insufficient funds to pay the initial commitment fee and the two anchor outputs. Eclair initially accepts such channels and responds with accept_channel, even though it will inevitably reject them one roundtrip later in the funding flow (after receiving funding_created). This is entirely a spec compliance issue.
Reproduction
test("recv OpenChannel (funder cannot afford commitment fee)") { f =>
import f._
val open = alice2bob.expectMsgType[OpenChannel]
// BOLT 2: the receiving node MUST fail the channel if the funder's amount for
// the initial commitment transaction is not sufficient for full fee payment.
// The funder owes the commit tx fee plus both anchors and pushes one sat
// too much, leaving them with insufficient funds to meet those obligations.
val spec = CommitmentSpec(Set.empty, open.feeratePerKw, 0 msat, 0 msat)
val fees = commitTxTotalCost(open.dustLimitSatoshis, spec, ZeroFeeHtlcTxAnchorOutputsCommitmentFormat)
bob ! open.copy(pushMsat = (open.fundingSatoshis - fees + 1.sat).toMilliSatoshi)
val error = bob2alice.expectMsgType[Error]
assert(error == Error(open.temporaryChannelId, CannotAffordFirstCommitFees(open.temporaryChannelId, missing = 1.sat, fees = fees).getMessage))
listener.expectMsgType[ChannelAborted]
awaitCond(bob.stateName == CLOSED)
}
If we continue the flow to funding_created, the makeCommitTxs check rejects the channel:
ERROR f.a.e.c.fsm.Channel - can't pay the fee in first commitment: missing=12214 sat fees=24423 sat
while processing msg=FundingCreated in state=WAIT_FOR_FUNDING_CREATED
Suggested fix
Apply the same check that already exists in makeCommitTxs in validateParamsSingleFundedFundee.
Discovery
Found while fuzzing the v1 funding protocol with smite.
BOLT 2 requires the receiver of
open_channelto fail the channel when the funder's amount cannot cover the initial commitment fee:Eclair implements the rule, but too late. The channel isn't rejected until later in the flow, after receiving
funding_created.Impact
A peer can set a
push_msatfor the channel that leaves insufficient funds to pay the initial commitment fee and the two anchor outputs. Eclair initially accepts such channels and responds withaccept_channel, even though it will inevitably reject them one roundtrip later in the funding flow (after receivingfunding_created). This is entirely a spec compliance issue.Reproduction
If we continue the flow to
funding_created, themakeCommitTxscheck rejects the channel:Suggested fix
Apply the same check that already exists in
makeCommitTxsinvalidateParamsSingleFundedFundee.Discovery
Found while fuzzing the v1 funding protocol with smite.