channeld: accept SHUTDOWN before channel is locked.
Fixes: #1308 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
71de234255
commit
1773b03380
|
@ -1589,7 +1589,9 @@ static void peer_in(struct peer *peer, const u8 *msg)
|
|||
|
||||
/* Must get funding_locked before almost anything. */
|
||||
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->gossip_index,
|
||||
&peer->channel_id,
|
||||
|
|
|
@ -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 (channel->state == CHANNELD_NORMAL)
|
||||
if (channel->state != CHANNELD_SHUTTING_DOWN)
|
||||
channel_set_state(channel,
|
||||
CHANNELD_NORMAL, CHANNELD_SHUTTING_DOWN);
|
||||
channel->state, CHANNELD_SHUTTING_DOWN);
|
||||
|
||||
/* TODO(cdecker) Selectively save updated fields to DB */
|
||||
wallet_channel_save(ld->wallet, channel);
|
||||
|
|
Loading…
Reference in New Issue