From 99bba2a23c31f3107f4a222d51ebfae5cbc273f3 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 7 May 2018 16:34:38 +0930 Subject: [PATCH] channeld: don't send ANNOUNCEMENT_SIGNATURES if we've send shutdown. 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 --- channeld/channel.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/channeld/channel.c b/channeld/channel.c index e81b27ed4..884c82ac5 100644 --- a/channeld/channel.c +++ b/channeld/channel.c @@ -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)) @@ -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]); @@ -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); @@ -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);