Log available liquidity on each channel when starting routefinding
[rust-lightning] / lightning / src / ln / channel.rs
index 5fbdb595b77101f8bf455e0761adc9de08437647..7819de3006db45fbe806f4fe570f10ca85467f5c 100644 (file)
@@ -1403,7 +1403,7 @@ pub(super) struct ChannelContext<SP: Deref> where SP::Target: SignerProvider {
        /// Either the height at which this channel was created or the height at which it was last
        /// serialized if it was serialized by versions prior to 0.0.103.
        /// We use this to close if funding is never broadcasted.
-       channel_creation_height: u32,
+       pub(super) channel_creation_height: u32,
 
        counterparty_dust_limit_satoshis: u64,
 
@@ -7520,6 +7520,12 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
                Ok(self.get_open_channel(chain_hash))
        }
 
+       /// Returns true if we can resume the channel by sending the [`msgs::OpenChannel`] again.
+       pub fn is_resumable(&self) -> bool {
+               !self.context.have_received_message() &&
+                       self.context.cur_holder_commitment_transaction_number == INITIAL_COMMITMENT_NUMBER
+       }
+
        pub fn get_open_channel(&self, chain_hash: ChainHash) -> msgs::OpenChannel {
                if !self.context.is_outbound() {
                        panic!("Tried to open a channel for an inbound channel?");