Browse Source

channeld: accept SHUTDOWN before channel is locked.

Fixes: #1308
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
1773b03380
  1. 4
      channeld/channel.c
  2. 4
      lightningd/channel_control.c

4
channeld/channel.c

@ -1589,7 +1589,9 @@ static void peer_in(struct peer *peer, const u8 *msg)
/* Must get funding_locked before almost anything. */ /* Must get funding_locked before almost anything. */
if (!peer->funding_locked[REMOTE]) { if (!peer->funding_locked[REMOTE]) {
if (type != WIRE_FUNDING_LOCKED && type != WIRE_PONG) { if (type != WIRE_FUNDING_LOCKED
&& type != WIRE_PONG
&& type != WIRE_SHUTDOWN) {
peer_failed(&peer->cs, peer_failed(&peer->cs,
peer->gossip_index, peer->gossip_index,
&peer->channel_id, &peer->channel_id,

4
lightningd/channel_control.c

@ -77,9 +77,9 @@ static void peer_got_shutdown(struct channel *channel, const u8 *msg)
} }
/* If we weren't already shutting down, we are now */ /* If we weren't already shutting down, we are now */
if (channel->state == CHANNELD_NORMAL) if (channel->state != CHANNELD_SHUTTING_DOWN)
channel_set_state(channel, channel_set_state(channel,
CHANNELD_NORMAL, CHANNELD_SHUTTING_DOWN); channel->state, CHANNELD_SHUTTING_DOWN);
/* TODO(cdecker) Selectively save updated fields to DB */ /* TODO(cdecker) Selectively save updated fields to DB */
wallet_channel_save(ld->wallet, channel); wallet_channel_save(ld->wallet, channel);

Loading…
Cancel
Save