Skip to content

Commit f4cef50

Browse files
committed
fixup! Expose APIs to access supported feature flags
remove per-peer/channel features
1 parent 436fb95 commit f4cef50

2 files changed

Lines changed: 2 additions & 73 deletions

File tree

src/lib.rs

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,7 @@ use lightning_background_processor::process_events_async;
157157
pub use lightning_invoice;
158158
pub use lightning_liquidity;
159159
pub use lightning_types;
160-
use lightning_types::features::{
161-
Bolt11InvoiceFeatures, ChannelFeatures, InitFeatures, NodeFeatures,
162-
};
160+
use lightning_types::features::NodeFeatures;
163161
use liquidity::{LSPS1Liquidity, LiquiditySource};
164162
use lnurl_auth::LnurlAuth;
165163
use logger::{log_debug, log_error, log_info, log_trace, LdkLogger, Logger};
@@ -1936,7 +1934,7 @@ impl Node {
19361934
})
19371935
}
19381936

1939-
/// Return the features used in node announcement.
1937+
/// Returns the node's invariant features used in node announcement.
19401938
pub fn node_features(&self) -> NodeFeatures {
19411939
let gossip_features = match self.gossip_source.as_gossip_sync() {
19421940
lightning_background_processor::GossipSync::P2P(p2p_gossip_sync) => {
@@ -1957,41 +1955,6 @@ impl Node {
19571955
.map(|ls| ls.liquidity_manager().provided_node_features())
19581956
.unwrap_or_else(NodeFeatures::empty)
19591957
}
1960-
1961-
/// Return the node's init features.
1962-
pub fn init_features(&self) -> InitFeatures {
1963-
let gossip_init_features = match self.gossip_source.as_gossip_sync() {
1964-
lightning_background_processor::GossipSync::P2P(p2p_gossip_sync) => {
1965-
p2p_gossip_sync.provided_init_features(self.node_id())
1966-
},
1967-
lightning_background_processor::GossipSync::Rapid(_) => InitFeatures::empty(),
1968-
lightning_background_processor::GossipSync::None => {
1969-
unreachable!("We must always have a gossip sync!")
1970-
},
1971-
};
1972-
self.channel_manager.init_features()
1973-
| self.chain_monitor.provided_init_features(self.node_id())
1974-
| self.onion_messenger.provided_init_features(self.node_id())
1975-
| gossip_init_features
1976-
| self
1977-
.liquidity_source
1978-
.as_ref()
1979-
.map(|ls| ls.liquidity_manager().provided_init_features(self.node_id()))
1980-
.unwrap_or_else(InitFeatures::empty)
1981-
}
1982-
1983-
/// Return the node's channel features.
1984-
pub fn channel_features(&self) -> ChannelFeatures {
1985-
self.channel_manager.channel_features()
1986-
}
1987-
1988-
/// Return the node's BOLT 11 invoice features.
1989-
pub fn bolt11_invoice_features(&self) -> Bolt11InvoiceFeatures {
1990-
// bolt11_invoice_features() is not public because feature
1991-
// flags can vary due to invoice type, so we convert from
1992-
// context.
1993-
self.channel_manager.init_features().to_context()
1994-
}
19951958
}
19961959

19971960
impl Drop for Node {

tests/integration_tests_rust.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2805,37 +2805,3 @@ async fn splice_in_with_all_balance() {
28052805
node_a.stop().unwrap();
28062806
node_b.stop().unwrap();
28072807
}
2808-
2809-
#[test]
2810-
fn node_feature_flags() {
2811-
let (bitcoind, electrsd) = setup_bitcoind_and_electrsd();
2812-
let chain_source = random_chain_source(&bitcoind, &electrsd);
2813-
let config = random_config(true);
2814-
let node = setup_node(&chain_source, config);
2815-
2816-
// NodeFeatures
2817-
let node_features = node.node_features();
2818-
assert!(node_features.supports_variable_length_onion());
2819-
assert!(node_features.supports_payment_secret());
2820-
assert!(node_features.supports_basic_mpp());
2821-
assert!(node_features.supports_keysend());
2822-
assert!(node_features.supports_onion_messages());
2823-
2824-
// InitFeatures
2825-
let init_features = node.init_features();
2826-
assert!(init_features.supports_variable_length_onion());
2827-
assert!(init_features.supports_payment_secret());
2828-
assert!(init_features.supports_basic_mpp());
2829-
assert!(init_features.supports_onion_messages());
2830-
2831-
// ChannelFeatures (non-empty)
2832-
let _channel_features = node.channel_features();
2833-
2834-
// Bolt11InvoiceFeatures
2835-
let bolt11_features = node.bolt11_invoice_features();
2836-
assert!(bolt11_features.supports_variable_length_onion());
2837-
assert!(bolt11_features.supports_payment_secret());
2838-
assert!(bolt11_features.supports_basic_mpp());
2839-
2840-
node.stop().unwrap();
2841-
}

0 commit comments

Comments
 (0)