Skip to content

Shutdown while awaiting lockin #1313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion channeld/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,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,
Expand Down
4 changes: 2 additions & 2 deletions lightningd/channel_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might a bit too permissive now? We probably also don't want to accept in state sigexchange.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're in channeld (which we are), we have to be in AWAITING_LOCKIN or NORMAL or SHUTTING_DOWN. So this is actually safe.

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);
Expand Down