Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Failure to reject `open_channel` where funder cannot pay commitment fee

Aperta Adatta ai principianti
#3,383 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
scala

Direzione di ricerca

La verifica da riutilizzare si trova già in makeCommitTxs in eclair-core/src/main/scala/fr/acinq/eclair/channel/Helpers.scala, e la nuova validazione va in validateParamsSingleFundedFundee nello stesso file. Inizia leggendo come vengono usati commitTxTotalCost e CannotAffordFirstCommitFees lì. L'issue include un caso ScalaTest, “recv OpenChannel (funder cannot afford commitment fee)”, da aggiungere alla suite di test di open-channel. È completato quando questo test passa: Bob risponde con un Error che contiene CannotAffordFirstCommitFees e il canale raggiunge lo stato CLOSED.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Scala
Stelle
1.3k
Fork
285
Merge medio
20h 22m
PR unite (30g)
28

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ACINQ/eclair

Tutte le issue di ACINQ/eclair

Issue simili

Altre issue su Scala

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.