Skip to content

Shutdown fixes #847

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 9 commits into from
Feb 2, 2018
13 changes: 13 additions & 0 deletions channeld/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,19 @@ static void send_commit(struct peer *peer)
return;
}

/* BOLT #2:
*
* - if no HTLCs remain in either commitment transaction:
* - MUST NOT send any `update` message after a `shutdown`.
*/
if (peer->shutdown_sent[LOCAL] && !channel_has_htlcs(peer->channel)) {
status_trace("Can't send commit: final shutdown phase");

peer->commit_timer = NULL;
tal_free(tmpctx);
return;
}

/* If we wanted to update fees, do it now. */
if (peer->channel->funder == LOCAL
&& peer->desired_feerate != channel_feerate(peer->channel, REMOTE)) {
Expand Down
Loading