From 5a06b665bdc03b22a8a6021bd434c934a1ccec40 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 19 Jan 2018 12:07:55 +1030 Subject: [PATCH] channeld: don't consider shutdown complete if feechange pending. Travis gave an error: ``` DEBUG:root:lightningd(16333): lightning_closingd(8004): STATUS_FAIL_PEER_BAD: Expected closing_signed: 0085b679bd79b836b05c649cad9af31156cb1d50de448a59c6359ab7c85f4b63913d2e3bc8ad4a80ab698558e5b4949b78dc36acc90dde4f5ac006fd6ca1d109feea03aef9c718e9ce09bbb52dc8308ba8f46b43808ea1a551d41aee72af7af77628d1 ``` Which is caused by us not waiting for the revoke-and-ack from a feechange when we're shutting down. Signed-off-by: Rusty Russell --- channeld/channel.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/channeld/channel.c b/channeld/channel.c index ca0177fd6..a601c342d 100644 --- a/channeld/channel.c +++ b/channeld/channel.c @@ -697,7 +697,10 @@ static bool shutdown_complete(const struct peer *peer) { return peer->shutdown_sent[LOCAL] && peer->shutdown_sent[REMOTE] - && !channel_has_htlcs(peer->channel); + && !channel_has_htlcs(peer->channel) + /* We could be awaiting revoke-and-ack for a feechange */ + && peer->revocations_received == peer->next_index[REMOTE] - 1; + } /* BOLT #2: