From 1993ec0d12c7503131dbb4564d6dbce29fbf1ff0 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 30 Oct 2018 15:53:34 -0400 Subject: [PATCH] Always send Shutdown resposnes to Shutdown messages We always require that any changes to Channel state be committed immediately (within the same lock) so we should never have uncommitted changes which would prevent us from sending a Shutdown response. --- src/ln/channel.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ln/channel.rs b/src/ln/channel.rs index ba8d1533d..33e09448f 100644 --- a/src/ln/channel.rs +++ b/src/ln/channel.rs @@ -2446,11 +2446,9 @@ impl Channel { _ => true } }); - for htlc in self.pending_outbound_htlcs.iter() { - if let OutboundHTLCState::LocalAnnounced(_) = htlc.state { - return Ok((None, None, dropped_outbound_htlcs)); - } - } + // If we have any LocalAnnounced updates we'll probably just get back a update_fail_htlc + // immediately after the commitment dance, but we can send a Shutdown cause we won't send + // any further commitment updates after we set LocalShutdownSent. let our_shutdown = if (self.channel_state & ChannelState::LocalShutdownSent as u32) == ChannelState::LocalShutdownSent as u32 { None -- 2.39.5