dualopend: keep track of whether we sent our tx_signatures
What changed, and why it matters
This change fixes a bookkeeping problem in Core Lightning's dual-funding channel opener (dualopend). The daemon now remembers whether it already sent its transaction signatures to the peer, and carries that memory across reconnects. Without this, after a reconnect the opener could forget it had already sent signatures and behave as if it hadn't, likely causing protocol confusion, duplicate sends, or a stuck channel open. The patch is small and defensive; the commit message does not call it a security fix, but it clearly corrects state-handling behavior that could affect funds safety.
Treat as a recommended stability and safety fix. Review whether the existing inflight->i_sent_sigs persistence in lightningd is correct and whether any other tx_state booleans (e.g., remote_funding_sigs_rcvd, has_commitments) need similar reconnect preservation. No immediate emergency response is indicated by the diff alone.
Security signals we found
state-desynchronization across reconnect
dual-funding signature replay/duplicate-send risk
potential channel open stall or inconsistent commitment state
defensive correctness fix in on-chain funding protocol
Evidence from the diff
The patch adds a boolean local_funding_sigs_sent to struct tx_state in openingd/dualopend.c, initializes it to false, sets it to true both in handle_send_tx_sigs (normal path) and in do_reconnect_dance when signatures are (re)sent, and passes it back in via the dualopend_reinit wire message so the state survives daemon restart on reconnect. The lightningd side sends the persisted inflight->i_sent_sigs value when reinitializing dualopend. This prevents the opener from losing track of signature transmission state across reconnects.
Changed components
openingd/dualopend.clightningd/dual_open_control.copeningd/dualopend_wire.csvInspect captured patch +11 / −2
### lightningd/dual_open_control.c
@@ -4393,7 +4393,8 @@ bool peer_restart_dualopend(struct peer *peer,
channel->type,
channel->req_confirmed_ins[LOCAL],
channel->req_confirmed_ins[REMOTE],
- *channel->alias[LOCAL]);
+ *channel->alias[LOCAL],
+ inflight->i_sent_sigs);
subd_send_msg(channel->owner, take(msg));
return true;
### openingd/dualopend.c
@@ -103,6 +103,9 @@ struct tx_state {
/* Have we gotten the peer's tx-sigs yet? */
bool remote_funding_sigs_rcvd;
+ /* Have we sent our tx_signatures to the peer? */
+ bool local_funding_sigs_sent;
+
/* Have we gotten the peer's commitments yet? */
bool has_commitments;
@@ -133,6 +136,7 @@ static struct tx_state *new_tx_state(const tal_t *ctx)
struct tx_state *tx_state = tal(ctx, struct tx_state);
tx_state->psbt = NULL;
tx_state->remote_funding_sigs_rcvd = false;
+ tx_state->local_funding_sigs_sent = false;
tx_state->has_commitments = false;
tx_state->lease_expiry = 0;
@@ -1480,6 +1484,7 @@ static void handle_send_tx_sigs(struct state *state, const u8 *msg)
/* Send our sigs to peer */
msg = psbt_to_tx_sigs_msg(tmpctx, state, tx_state->psbt);
peer_write(state->pps, take(msg));
+ tx_state->local_funding_sigs_sent = true;
/* Notify lightningd that we've sent sigs */
wire_sync_write(REQ_FD, take(towire_dualopend_tx_sigs_sent(NULL)));
@@ -4127,6 +4132,7 @@ static void do_reconnect_dance(struct state *state)
if (send_our_sigs && psbt_side_finalized(tx_state->psbt, state->our_role)) {
msg = psbt_to_tx_sigs_msg(NULL, state, tx_state->psbt);
peer_write(state->pps, take(msg));
+ tx_state->local_funding_sigs_sent = true;
/* Notify lightningd that we've (re)sent sigs */
wire_sync_write(REQ_FD, take(towire_dualopend_tx_sigs_sent(NULL)));
@@ -4499,7 +4505,8 @@ int main(int argc, char *argv[])
&state->channel_type,
&state->require_confirmed_inputs[LOCAL],
&state->require_confirmed_inputs[REMOTE],
- &state->local_alias)) {
+ &state->local_alias,
+ &state->tx_state->local_funding_sigs_sent)) {
bool ok;
### openingd/dualopend_wire.csv
@@ -86,6 +86,7 @@ msgdata,dualopend_reinit,channel_type,channel_type,
msgdata,dualopend_reinit,we_require_confirmed_inputs,bool,
msgdata,dualopend_reinit,they_require_confirmed_inputs,bool,
msgdata,dualopend_reinit,local_alias,short_channel_id,
+msgdata,dualopend_reinit,local_funding_sigs_sent,bool,
# dualopend->master: they offered channel, should we continue?
msgtype,dualopend_got_offer,7005Why this scored 41/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.