X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-rapid-gossip-sync%2Fsrc%2Fprocessing.rs;fp=lightning-rapid-gossip-sync%2Fsrc%2Fprocessing.rs;h=b387d49998e9a38d6f1693e1a18d05c4da57e675;hb=b336b2e92a14575487656bc90f92f7121d2efd22;hp=9e9a1ef862ef0f46c50a08c18bd0aed2ae7d1910;hpb=cff1b4bce349f5f80fd8093ef7f97ab3c2e76d71;p=rust-lightning diff --git a/lightning-rapid-gossip-sync/src/processing.rs b/lightning-rapid-gossip-sync/src/processing.rs index 9e9a1ef8..b387d499 100644 --- a/lightning-rapid-gossip-sync/src/processing.rs +++ b/lightning-rapid-gossip-sync/src/processing.rs @@ -38,13 +38,14 @@ const MAX_INITIAL_NODE_ID_VECTOR_CAPACITY: u32 = 50_000; const STALE_RGS_UPDATE_AGE_LIMIT_SECS: u64 = 60 * 60 * 24 * 14; impl>, L: Deref> RapidGossipSync where L::Target: Logger { + #[cfg(feature = "std")] pub(crate) fn update_network_graph_from_byte_stream( &self, read_cursor: &mut R, ) -> Result { #[allow(unused_mut, unused_assignments)] let mut current_time_unix = None; - #[cfg(all(feature = "std", not(test)))] + #[cfg(not(test))] { // Note that many tests rely on being able to set arbitrarily old timestamps, thus we // disable this check during tests! @@ -252,7 +253,9 @@ impl>, L: Deref> RapidGossipSync where L mod tests { use bitcoin::Network; + #[cfg(feature = "std")] use lightning::ln::msgs::DecodeError; + use lightning::routing::gossip::NetworkGraph; use lightning::util::test_utils::TestLogger; @@ -280,6 +283,7 @@ mod tests { const VALID_BINARY_TIMESTAMP: u64 = 1642291930; #[test] + #[cfg(feature = "std")] fn network_graph_fails_to_update_from_clipped_input() { let logger = TestLogger::new(); let network_graph = NetworkGraph::new(Network::Bitcoin, &logger); @@ -311,6 +315,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn incremental_only_update_ignores_missing_channel() { let incremental_update_input = vec![ 76, 68, 75, 1, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, @@ -331,6 +336,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn incremental_only_update_fails_without_prior_updates() { let announced_update_input = vec![ 76, 68, 75, 1, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, @@ -358,6 +364,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn incremental_only_update_fails_without_prior_same_direction_updates() { let initialization_input = vec![ 76, 68, 75, 1, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, @@ -413,6 +420,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn incremental_update_succeeds_with_prior_announcements_and_full_updates() { let initialization_input = vec![ 76, 68, 75, 1, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, @@ -472,6 +480,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn update_succeeds_when_duplicate_gossip_is_applied() { let initialization_input = vec![ 76, 68, 75, 1, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247, @@ -515,6 +524,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn full_update_succeeds() { let logger = TestLogger::new(); let network_graph = NetworkGraph::new(Network::Bitcoin, &logger); @@ -624,6 +634,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] pub fn update_fails_with_unknown_version() { let unknown_version_input = vec![ 76, 68, 75, 2, 111, 226, 140, 10, 182, 241, 179, 114, 193, 166, 162, 70, 174, 99, 247,