Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ use lightning::impl_writeable_tlv_based;
use lightning::ln::chan_utils::FUNDING_TRANSACTION_WITNESS_WEIGHT;
use lightning::ln::channel_state::{ChannelDetails as LdkChannelDetails, ChannelShutdownState};
use lightning::ln::channelmanager::PaymentId;
use lightning::ln::msgs::SocketAddress;
use lightning::ln::msgs::{BaseMessageHandler, SocketAddress};
use lightning::ln::peer_handler::CustomMessageHandler;
use lightning::routing::gossip::NodeAlias;
use lightning::sign::EntropySource;
use lightning::util::persist::KVStoreSync;
Expand All @@ -156,6 +157,7 @@ use lightning_background_processor::process_events_async;
pub use lightning_invoice;
pub use lightning_liquidity;
pub use lightning_types;
use lightning_types::features::NodeFeatures;
use liquidity::{LSPS1Liquidity, LiquiditySource};
use lnurl_auth::LnurlAuth;
use logger::{log_debug, log_error, log_info, log_trace, LdkLogger, Logger};
Expand Down Expand Up @@ -1931,6 +1933,28 @@ impl Node {
Error::PersistenceFailed
})
}

/// Returns the node's invariant features used in node announcement.
pub fn features(&self) -> NodeFeatures {
let gossip_features = match self.gossip_source.as_gossip_sync() {
lightning_background_processor::GossipSync::P2P(p2p_gossip_sync) => {
p2p_gossip_sync.provided_node_features()
},
lightning_background_processor::GossipSync::Rapid(_) => NodeFeatures::empty(),
lightning_background_processor::GossipSync::None => {
unreachable!("We must always have a gossip sync!")
},
};
self.channel_manager.node_features()
| self.chain_monitor.provided_node_features()
| self.onion_messenger.provided_node_features()
| gossip_features
| self
.liquidity_source
.as_ref()
.map(|ls| ls.liquidity_manager().provided_node_features())
.unwrap_or_else(NodeFeatures::empty)
}
}

impl Drop for Node {
Expand Down
Loading