Log shutdown including which side of the channel initiated shutdown
[rust-lightning] / lightning / src / ln / channel.rs
index cd819fb14ddf046e50440c8b0b3e801bf346e023..e41d6d287b914d060149d047408ca5b7c1e2b191 100644 (file)
@@ -3816,6 +3816,16 @@ impl<Signer: Sign> Channel<Signer> {
                self.channel_state >= ChannelState::FundingSent as u32
        }
 
+       /// Returns true if our peer has either initiated or agreed to shut down the channel.
+       pub fn received_shutdown(&self) -> bool {
+               (self.channel_state & ChannelState::RemoteShutdownSent as u32) != 0
+       }
+
+       /// Returns true if we either initiated or agreed to shut down the channel.
+       pub fn sent_shutdown(&self) -> bool {
+               (self.channel_state & ChannelState::LocalShutdownSent as u32) != 0
+       }
+
        /// Returns true if this channel is fully shut down. True here implies that no further actions
        /// may/will be taken on this channel, and thus this object should be freed. Any future changes
        /// will be handled appropriately by the chain monitor.