- /// Returns true if this channel is currently available for receiving inbound payments *to us*.
- /// This may be true even if [`is_usable`] (or [`is_live`]) is *not* true, if our counterparty
- /// is willing to forward payments to us with 0 confirmations on the funding transaction.
- /// Note that payments received on this channel MUST NOT be forwarded unless we've marked the
- /// channel trusted or [`is_usable`] is also true.
- /// Allowed in any state (including after shutdown)
- pub fn is_receivable(&self) -> bool {
- let non_live_state_reqd = ChannelState::TheirFundingLocked as u32 | ChannelState::ChannelState::FundingSent as u32;
- self.is_live() || (
- (self.channel_state & BOTH_SIDES_SHUTDOWN_MASK) == 0 &&
- (self.channel_state & ChannelState::PeerDisconnected as u32) == 0 &&
- (self.channel_state & non_live_state_reqd) == non_live_state_reqd
- )
- }
-