]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Always send Shutdown resposnes to Shutdown messages
authorMatt Corallo <git@bluematt.me>
Tue, 30 Oct 2018 19:53:34 +0000 (15:53 -0400)
committerMatt Corallo <git@bluematt.me>
Thu, 1 Nov 2018 21:06:07 +0000 (17:06 -0400)
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

index ba8d1533db1aec6ee775773d8f0823eb8b9ace6d..33e09448f4170f2a6e4fa70ef0f9f5a568cb938c 100644 (file)
@@ -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