From 217df2d2e85681744043b7c52db3df6128c37f20 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 18 Aug 2017 14:13:39 +0930 Subject: [PATCH] channeld: fix shutdown when we have to complete HTLCs. We need to check if we exit after sending a revoke_and_ack, otherwise channeld ends up getting the closing_signed packet. Signed-off-by: Rusty Russell --- lightningd/channel/channel.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lightningd/channel/channel.c b/lightningd/channel/channel.c index b2de1f6f3..6390c8359 100644 --- a/lightningd/channel/channel.c +++ b/lightningd/channel/channel.c @@ -701,6 +701,10 @@ static struct io_plan *send_revocation(struct io_conn *conn, struct peer *peer) msg_enqueue(&peer->peer_out, take(msg)); + /* This might have been the final revoke_and_ack... */ + if (shutdown_complete(peer)) + io_break(peer); + return peer_read_message(conn, &peer->pcs, peer_in); }