From: Jeffrey Czyz Date: Thu, 3 Mar 2022 23:41:44 +0000 (-0800) Subject: Fix compilation warnings with --features=no-std X-Git-Tag: v0.0.106~31^2~1 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=d70292d6c8db9ee4ddc7889ddc4682b9cfc6be72;p=rust-lightning Fix compilation warnings with --features=no-std --- diff --git a/lightning-invoice/src/utils.rs b/lightning-invoice/src/utils.rs index fc82541a5..78a092e24 100644 --- a/lightning-invoice/src/utils.rs +++ b/lightning-invoice/src/utils.rs @@ -10,7 +10,9 @@ use lightning::chain; use lightning::chain::chaininterface::{BroadcasterInterface, FeeEstimator}; use lightning::chain::keysinterface::{Recipient, KeysInterface, Sign}; use lightning::ln::{PaymentHash, PaymentPreimage, PaymentSecret}; -use lightning::ln::channelmanager::{ChannelDetails, ChannelManager, PaymentId, PaymentSendFailure, PhantomRouteHints, MIN_FINAL_CLTV_EXPIRY, MIN_CLTV_EXPIRY_DELTA}; +use lightning::ln::channelmanager::{ChannelDetails, ChannelManager, PaymentId, PaymentSendFailure, MIN_FINAL_CLTV_EXPIRY}; +#[cfg(feature = "std")] +use lightning::ln::channelmanager::{PhantomRouteHints, MIN_CLTV_EXPIRY_DELTA}; use lightning::ln::msgs::LightningError; use lightning::routing::scoring::Score; use lightning::routing::network_graph::{NetworkGraph, RoutingFees}; diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index c45ce59ac..1360aa3dd 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -1537,9 +1537,9 @@ where L::Target: Logger { #[cfg(test)] mod tests { - use routing::scoring::{ProbabilisticScorer, ProbabilisticScoringParameters, Score}; use routing::network_graph::{NetworkGraph, NetGraphMsgHandler, NodeId}; use routing::router::{get_route, PaymentParameters, Route, RouteHint, RouteHintHop, RouteHop, RoutingFees}; + use routing::scoring::Score; use chain::transaction::OutPoint; use ln::features::{ChannelFeatures, InitFeatures, InvoiceFeatures, NodeFeatures}; use ln::msgs::{ErrorAction, LightningError, OptionalField, UnsignedChannelAnnouncement, ChannelAnnouncement, RoutingMessageHandler, @@ -4970,6 +4970,8 @@ mod tests { #[test] #[cfg(not(feature = "no-std"))] fn generate_routes() { + use routing::scoring::{ProbabilisticScorer, ProbabilisticScoringParameters}; + let mut d = match super::test_utils::get_route_file() { Ok(f) => f, Err(e) => { @@ -5002,6 +5004,8 @@ mod tests { #[test] #[cfg(not(feature = "no-std"))] fn generate_routes_mpp() { + use routing::scoring::{ProbabilisticScorer, ProbabilisticScoringParameters}; + let mut d = match super::test_utils::get_route_file() { Ok(f) => f, Err(e) => { diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index 9cd2f9ec1..2ec679232 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -411,7 +411,10 @@ impl events::MessageSendEventsProvider for TestRoutingMessageHandler { pub struct TestLogger { level: Level, + #[cfg(feature = "std")] id: String, + #[cfg(not(feature = "std"))] + _id: String, pub lines: Mutex>, } @@ -422,7 +425,10 @@ 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()) } }