dualfund, tx-abort: only check for abort state if we're sending

In the case where you're echoing back a tx-abort, just let it through.

Not doing this causes problems in the case where your node has forgotten
about an in-progress open.

This fixes the following problem:

- you send a tx-abort (even tho you have marked tx-sigs as received)
- peer echos it back (we echo back tx-aborts always)
- you throw an error because you're already in a tx-abort unallowed
  state

In this commit, we allow for echos to come thru no matter our current state and
this fixes things/makes them work as expected.
This commit is contained in:
niftynei 2023-10-27 15:06:43 -05:00 committed by Rusty Russell
parent 979276386a
commit b2d2796aad

View File

@ -1489,12 +1489,6 @@ static void handle_tx_abort(struct state *state, u8 *msg)
{
const char *desc;
/* If they sent this after tx-sigs, it's a
* protocol error */
if (state->tx_state->remote_funding_sigs_rcvd)
open_err_fatal(state, "tx-abort rcvd after"
" tx-sigs");
/*
* BOLT-07cc0edc791aff78398a48fc31ee23b45374d8d9 #2:
*
@ -1504,6 +1498,12 @@ static void handle_tx_abort(struct state *state, u8 *msg)
* process without worrying about stale messages.
*/
if (!state->aborted_err) {
/* If they sent this after tx-sigs, it's a
* protocol error */
if (state->tx_state->remote_funding_sigs_rcvd)
open_err_fatal(state, "tx-abort rcvd after"
" tx-sigs");
open_abort(state, "%s", "Rcvd tx-abort");
desc = tal_fmt(tmpctx, "They sent %s",
sanitize_error(tmpctx, msg, NULL));