Skip to content

Commit

Permalink
closingd: ignore premature messages here, too.
Browse files Browse the repository at this point in the history
Fixes the less common case where we reconnect during mutual close.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Apr 12, 2019
1 parent 9366787 commit 0e8945f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions closingd/closingd.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,17 @@ static void do_reconnect(struct crypto_state *cs,
sync_crypto_write(cs, PEER_FD, take(msg));

/* They might have already send reestablish, which triggered us */
if (!channel_reestablish)
channel_reestablish = closing_read_peer_msg(tmpctx, cs, channel_id);
if (!channel_reestablish) {
do {
tal_free(channel_reestablish);
channel_reestablish = closing_read_peer_msg(tmpctx, cs,
channel_id);
/* They *should* send reestablish first, but lnd
* sends other messages, which we can ignore since
* we're closing anyway... */
} while (fromwire_peektype(channel_reestablish)
!= WIRE_CHANNEL_REESTABLISH);
}

if (!fromwire_channel_reestablish(channel_reestablish, &their_channel_id,
&next_local_commitment_number,
Expand Down

0 comments on commit 0e8945f

Please sign in to comment.