Skip to content

Commit

Permalink
channeld: don't send ANNOUNCEMENT_SIGNATURES if we've send shutdown.
Browse files Browse the repository at this point in the history
Our closingd doesn't handle it:

lightningd(2968): 0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518 chan #1:
 Peer permanent failure in CLOSINGD_SIGEXCHANGE: lightning_closingd: sent ERROR Expected closing_signed:
 0103ff54517293892ec3f214f2343c54cbfbf24aa6ffb8d5585d3bc1b543eae0a272000067000001000146390e0c043c777226927eacd2186a03f064e4bdc30f891cb6e4990af49967d34b338755e99d728987e3d49227815e17f3ab40092434a59e33548e870071176d26d19a4e4d8f7715c13ac2d6bf3238608a1ccf9afd91f774d84d170d9edddebf7460c54d49bd6cd81410bc3eeeba2b7278b1b5f7e748d77d793f31086847d582

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell authored and cdecker committed May 7, 2018
1 parent 6231e99 commit 99bba2a
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions channeld/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,10 @@ static void handle_peer_funding_locked(struct peer *peer, const u8 *msg)
if (peer->funding_locked[REMOTE])
return;

/* Too late, we're shutting down! */
if (peer->shutdown_sent[LOCAL])
return;

peer->old_remote_per_commit = peer->remote_per_commit;
if (!fromwire_funding_locked(msg, &chanid,
&peer->remote_per_commit))
Expand Down Expand Up @@ -1930,6 +1934,10 @@ static void handle_funding_locked(struct peer *peer, const u8 *msg)
&peer->short_channel_ids[LOCAL]))
master_badmsg(WIRE_CHANNEL_FUNDING_LOCKED, msg);

/* Too late, we're shutting down! */
if (peer->shutdown_sent[LOCAL])
return;

per_commit_point(&peer->shaseed,
&next_per_commit_point, peer->next_index[LOCAL]);

Expand All @@ -1954,6 +1962,10 @@ static void handle_funding_announce_depth(struct peer *peer)
if (peer->announce_depth_reached)
return;

/* Too late, we're shutting down! */
if (peer->shutdown_sent[LOCAL])
return;

peer->announce_depth_reached = true;
send_announcement_signatures(peer);

Expand Down Expand Up @@ -2531,9 +2543,12 @@ static void init_channel(struct peer *peer)
if (funding_signed)
enqueue_peer_msg(peer, take(funding_signed));

/* It's possible that we died previously before doing these. */
send_temporary_announcement(peer);
send_announcement_signatures(peer);
/* Don't send if we're shutting down */
if (!peer->shutdown_sent[LOCAL]) {
/* It's possible that we died previously before doing these. */
send_temporary_announcement(peer);
send_announcement_signatures(peer);
}

billboard_update(peer);
tal_free(msg);
Expand Down

0 comments on commit 99bba2a

Please sign in to comment.