X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=inline;f=lightning%2Fsrc%2Futil%2Ftest_utils.rs;h=b0f9ba0a98ebf0efffbfa6ee5ee1b6a00fa7ab75;hb=877a5fc9c0d7455bcbde8dbd9d314664bdcfba90;hp=b274a0d82539d0d4519f4321f68c867a96f47fe1;hpb=989cb064b5279da3c9e0f3a121637d8bbed81bfb;p=rust-lightning diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index b274a0d82..b0f9ba0a9 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -358,7 +358,10 @@ impl msgs::ChannelMessageHandler for TestChannelMessageHandler { self.received_msg(wire::Message::Error(msg.clone())); } fn provided_node_features(&self) -> NodeFeatures { - NodeFeatures::empty() + NodeFeatures::known_channel_features() + } + fn provided_init_features(&self, _their_init_features: &PublicKey) -> InitFeatures { + InitFeatures::known_channel_features() } } @@ -507,6 +510,18 @@ impl msgs::RoutingMessageHandler for TestRoutingMessageHandler { fn handle_query_short_channel_ids(&self, _their_node_id: &PublicKey, _msg: msgs::QueryShortChannelIds) -> Result<(), msgs::LightningError> { Ok(()) } + + fn provided_node_features(&self) -> NodeFeatures { + let mut features = NodeFeatures::empty(); + features.set_gossip_queries_optional(); + features + } + + fn provided_init_features(&self, _their_init_features: &PublicKey) -> InitFeatures { + let mut features = InitFeatures::empty(); + features.set_gossip_queries_optional(); + features + } } impl events::MessageSendEventsProvider for TestRoutingMessageHandler { @@ -520,10 +535,7 @@ impl events::MessageSendEventsProvider for TestRoutingMessageHandler { pub struct TestLogger { level: Level, - #[cfg(feature = "std")] - id: String, - #[cfg(not(feature = "std"))] - _id: String, + pub(crate) id: String, pub lines: Mutex>, } @@ -534,10 +546,7 @@ impl TestLogger { pub fn with_id(id: String) -> TestLogger { TestLogger { level: Level::Trace, - #[cfg(feature = "std")] id, - #[cfg(not(feature = "std"))] - _id: id, lines: Mutex::new(HashMap::new()) } } @@ -561,10 +570,10 @@ impl TestLogger { assert_eq!(l, count) } - /// Search for the number of occurrences of logged lines which - /// 1. belong to the specified module and - /// 2. match the given regex pattern. - /// Assert that the number of occurrences equals the given `count` + /// Search for the number of occurrences of logged lines which + /// 1. belong to the specified module and + /// 2. match the given regex pattern. + /// Assert that the number of occurrences equals the given `count` pub fn assert_log_regex(&self, module: String, pattern: regex::Regex, count: usize) { let log_entries = self.lines.lock().unwrap(); let l: usize = log_entries.iter().filter(|&(&(ref m, ref l), _c)| {