diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 238102360f4d..25972d5c36c2 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -1712,6 +1712,7 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend, struct lightningd *ld = dualopend->ld; struct channel *channel = dualopend->channel; struct channel_inflight *inflight; + bool had_sigs; if (!fromwire_dualopend_funding_sigs(tmpctx, msg, &psbt)) { channel_internal_error(channel, @@ -1729,10 +1730,6 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend, return; } - /* Save that we've gotten their sigs. Sometimes - * the peer doesn't send any sigs (no inputs), otherwise - * we could just check the PSBT was finalized */ - inflight->remote_tx_sigs = true; tal_wally_start(); if (wally_psbt_combine(inflight->funding_psbt, psbt) != WALLY_OK) { channel_internal_error(channel, @@ -1747,13 +1744,21 @@ static void handle_peer_tx_sigs_msg(struct subd *dualopend, return; } tal_wally_end(inflight->funding_psbt); + + /* Save that we've gotten their sigs. Sometimes + * the peer doesn't send any sigs (no inputs), otherwise + * we could just check the PSBT was finalized */ + had_sigs = inflight->remote_tx_sigs; + inflight->remote_tx_sigs = true; wallet_inflight_save(ld->wallet, inflight); /* It's possible we haven't sent them our (empty) tx-sigs yet, * but we should be sending it soon... */ if (psbt_finalize(cast_const(struct wally_psbt *, inflight->funding_psbt)) - && !inflight->tx_broadcast) { + && !inflight->tx_broadcast + && !had_sigs) { + inflight->tx_broadcast = true; /* Saves the now finalized version of the psbt */