dualopend: abort politely instead of erroring when we haven't signed
What changed, and why it matters
This change fixes how Core Lightning handles an early shutdown during a dual-funded channel opening. Previously, if the node was asked to fail before it had sent its transaction signatures, it would treat it as a fatal error and remember the channel unnecessarily. Now it sends a polite 'tx_abort' message and forgets the channel, which is what the Lightning protocol specification recommends. This avoids leaving half-open channels stuck in memory and reduces unnecessary error handling.
Apply the patch. It is a low-risk, spec-compliant cleanup fix. Monitor for any related issues in dual-funded channel open abort handling, particularly around state transitions after `tx_signatures` are sent.
Security signals we found
Protocol state machine correction for dual-funded channel open
Avoids unnecessary retention of channels in committed-but-unsigned state
Replaces fatal error path with spec-compliant tx_abort
Prevents potential resource exhaustion or stuck channels from repeated aborts
Evidence from the diff
In the dual-funding flow, if lightningd instructs dualopend to fail before tx_signatures have been transmitted, the daemon now calls open_abort() and returns, rather than open_err_fatal(). The control path in lightningd/dual_open_control.c now recognizes the DUALOPEND_OPEN_COMMITTED state combined with !channel_funding_sigs_sent() as a clean abort and deletes the channel. The change aligns with BOLT #2’s tx_abort sender rule: a node that has not yet sent tx_signatures SHOULD forget the negotiation and reset state. This is a protocol-correctness and resource-cleanup fix, not a cryptographic or remote-exploitable vulnerability.
Changed components
lightningd/dual_open_control.copeningd/dualopend.cDual-funded channel opening protocol state machineInspect captured patch +25 / −0
### lightningd/dual_open_control.c
@@ -4096,6 +4096,17 @@ static void dualopen_errmsg(struct channel *channel,
delete_channel(channel, false);
return;
}
+ /* Negotiation was cleanly aborted after commitments
+ * were exchanged, but before we sent tx_signatures:
+ * safe to forget (BOLT #2 tx_abort sender rule). */
+ if (!warning
+ && channel->state == DUALOPEND_OPEN_COMMITTED
+ && !channel_funding_sigs_sent(channel)) {
+ log_info(channel->log, "%s", "Open aborted before we sent"
+ " tx_signatures. Deleting channel.");
+ delete_channel(channel, false);
+ return;
+ }
if (channel_funding_sigs_sent(channel))
log_info(channel->log,
"Already sent tx_signatures, remembering channel");
### openingd/dualopend.c
@@ -606,6 +606,20 @@ static void handle_failure_fatal(struct state *state, u8 *msg)
if (!fromwire_dualopend_fail(msg, msg, &err))
master_badmsg(fromwire_peektype(msg), msg);
+ /* BOLT #2:
+ *
+ * A sending node:
+ * - MUST NOT have already transmitted `tx_signatures`
+ * - SHOULD forget the current negotiation and reset their state.
+ */
+ /* We can still cleanly abort (tx_abort) if we haven't
+ * transmitted our tx_signatures; we'll finish up when the
+ * peer echoes the abort back */
+ if (!state->tx_state->local_funding_sigs_sent) {
+ open_abort(state, "%s", err);
+ return;
+ }
+
/* We're gonna fail here */
open_err_fatal(state, "%s", err);
}Why this scored 37/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.