Skip to content

connectd: swallow channel-scoped error instead of queuing it - #9436

Open
vincenzopalazzo wants to merge 2 commits into
ElementsProject:masterfrom
vincenzopalazzo:connectd-forward-channel-error
Open

connectd: swallow channel-scoped error instead of queuing it#9436
vincenzopalazzo wants to merge 2 commits into
ElementsProject:masterfrom
vincenzopalazzo:connectd-forward-channel-error

Conversation

@vincenzopalazzo

@vincenzopalazzo vincenzopalazzo commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

BOLT #1 says upon receiving a channel-scoped error the node MUST fail that channel. connectd only told lightningd about WIRE_ERROR when find_subd failed; if a subd existed the error was queued to it. channeld abort()s if it ever sees WIRE_ERROR ("swallowed by connectd"), and a dying channeld never reads the queue, so the channel stayed CHANNELD_NORMAL.

Always swallow a channel-scoped WIRE_ERROR in connectd: tell lightningd via CONNECTD_PEER_SPOKE and do not enqueue, whether or not a subd exists. handle_peer_spoke already permanently fails the channel. Do not create a dummy subd just to carry the error.

Two commits, failing test then fix:

  1. tests: reproduce lost channel error while channeld is exiting (@pytest.mark.xfail(strict=True))
  2. connectd: swallow channel-scoped error instead of queuing it (removes the xfail)

Local test_channel_error_not_lost_while_channeld_exits:

  • test commit / unfixed connectd: FAILED in 35.89s (Timeout while waiting for AWAITING_UNILATERAL)
  • fix commit: PASSED in 19.42s

Thanks to Leo Nash (@tankyleo) for the report.

Fixes: #9424
Reported-by: Leo Nash (@tankyleo)
Changelog-Fixed: Protocol: fail the channel on a peer error even if channeld is exiting.

BOLT ElementsProject#1 says upon receiving a channel-scoped error the node MUST
fail that channel.  connectd only told lightningd about WIRE_ERROR
when find_subd failed; if a dying channeld still existed the error
was queued and never read, so the channel stayed CHANNELD_NORMAL.

The test rolls l2's db back after a payment, freezes l1's channeld
after reestablish, then lets l2 send "Awaiting unilateral close".
It fails until the next commit.

Reproduces: ElementsProject#9424
Reported-by: Leo Nash (@tankyleo)
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
@vincenzopalazzo
vincenzopalazzo force-pushed the connectd-forward-channel-error branch from 5e70d0d to cf9378e Compare August 18, 2026 11:14
channeld abort()s on WIRE_ERROR ("swallowed by connectd"), but we
only told lightningd when find_subd failed.  If a subd existed we
enqueued the error; a dying channeld never read it, and a live
one would abort, so the channel stayed up.

Always tell lightningd via CONNECTD_PEER_SPOKE and do not enqueue.
handle_peer_spoke already permanently fails the channel.

Fixes: ElementsProject#9424
Changelog-Fixed: Protocol: fail the channel on a peer error even if channeld is exiting.
Reported-by: Leo Nash (@tankyleo)
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
@vincenzopalazzo
vincenzopalazzo force-pushed the connectd-forward-channel-error branch from cf9378e to 996dc6e Compare August 18, 2026 11:38
@vincenzopalazzo vincenzopalazzo changed the title connectd: forward channel-scoped error even if subd exists connectd: swallow channel-scoped error instead of queuing it Aug 18, 2026
@vincenzopalazzo
vincenzopalazzo requested review from Andezion and nGoline and removed request for Andezion August 18, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Channel-scoped error can be lost while channeld exits

1 participant