From 979276386a92eec287d56574f218eeaa1237b30e Mon Sep 17 00:00:00 2001 From: niftynei Date: Fri, 27 Oct 2023 15:03:30 -0500 Subject: [PATCH] dualfund: update handling of tx-sigs If you get the right series of disconnects, it's possible for your peer to send you a tx-sigs even though the current state of the channel open is that you've seen the funding open on chain (your channel_ready[LOCAL] = true) In this case, if we haven't marked that we've seen the tx sigs yet, we go ahead and mark them as seen and just ignore this tx-sigs msg. --- openingd/dualopend.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/openingd/dualopend.c b/openingd/dualopend.c index f9b2a72d1..085f9e242 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -1282,18 +1282,25 @@ static void handle_tx_sigs(struct state *state, const u8 *msg) tal_hex(msg, msg)); /* Maybe they didn't get our channel_ready message ? */ - if (state->channel_ready[LOCAL] && !state->reconnected) { - status_broken("Got WIRE_TX_SIGNATURES after channel_ready " - "for channel %s, ignoring: %s", - type_to_string(tmpctx, struct channel_id, - &state->channel_id), - tal_hex(tmpctx, msg)); + if (state->channel_ready[LOCAL]) { + if (!state->tx_state->remote_funding_sigs_rcvd) { + state->tx_state->remote_funding_sigs_rcvd = true; + status_info("Got WIRE_TX_SIGNATURES after channel_ready " + "for channel %s, ignoring: %s", + type_to_string(tmpctx, struct channel_id, + &state->channel_id), + tal_hex(tmpctx, msg)); + } else { + status_broken("Got WIRE_TX_SIGNATURES after channel_ready " + "for channel %s, ignoring: %s", + type_to_string(tmpctx, struct channel_id, + &state->channel_id), + tal_hex(tmpctx, msg)); + } return; } - /* On reconnect, we expect them to resend tx_sigs if they haven't - * gotten our channel_ready yet */ - if (state->channel_ready[REMOTE] && !state->reconnected) + if (state->channel_ready[REMOTE]) open_err_warn(state, "tx_signatures sent after channel_ready %s", tal_hex(msg, msg));