diff --git a/src/lib.rs b/src/lib.rs index 97a179c95f..ad99ea08ca 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -165,7 +165,6 @@ use lightning::ln::funding::{ 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::KVStore; use lightning::util::wallet_utils::{ConfirmedUtxo, Wallet as LdkWallet}; diff --git a/src/liquidity/client/lsps2/mod.rs b/src/liquidity/client/lsps2/mod.rs index 239faad191..b1df546036 100644 --- a/src/liquidity/client/lsps2/mod.rs +++ b/src/liquidity/client/lsps2/mod.rs @@ -32,6 +32,12 @@ use lightning_types::payment::PaymentHash; use tokio::sync::oneshot; use tokio::task::JoinSet; +use self::router::LSPS2LeaseParameters; +use self::state::{ + is_lease_usable, is_lease_valid_for, now_secs, LSPS2LeaseState, LeaseCacheTarget, + LeaseCacheTargetId, LeaseCacheTargetStore, PaymentLease, PaymentLeaseId, PaymentLeaseStore, + PendingLeaseRequestState, MIN_CACHED_LEASE_REMAINING_SECS, +}; use crate::connection::ConnectionManager; use crate::liquidity::{ select_all_lsps_for_protocol, select_lsps_for_protocol, LspConfig, LspNode, PendingRequest, @@ -44,13 +50,6 @@ use crate::runtime::Runtime; use crate::types::{ChannelManager, KeysManager, LiquidityManager}; use crate::{Config, Error}; -use self::router::LSPS2LeaseParameters; -use self::state::{ - is_lease_usable, is_lease_valid_for, now_secs, LSPS2LeaseState, LeaseCacheTarget, - LeaseCacheTargetId, LeaseCacheTargetStore, PaymentLease, PaymentLeaseId, PaymentLeaseStore, - PendingLeaseRequestState, MIN_CACHED_LEASE_REMAINING_SECS, -}; - // LSPS2 requires two blocks more than the usual final CLTV delta. const LSPS2_MIN_FINAL_CLTV_EXPIRY_DELTA: u16 = MIN_FINAL_CLTV_EXPIRY_DELTA + 2; @@ -1337,10 +1336,10 @@ pub(crate) struct LSPS2BuyResponse { #[cfg(test)] mod tests { - use super::*; use std::future::poll_fn; use std::task::Poll; + use super::*; use crate::builder::NodeBuilder; use crate::entropy::NodeEntropy; use crate::io::test_utils::InMemoryStore; diff --git a/src/liquidity/client/lsps2/router.rs b/src/liquidity/client/lsps2/router.rs index 579d07c1a6..879e94f8fa 100644 --- a/src/liquidity/client/lsps2/router.rs +++ b/src/liquidity/client/lsps2/router.rs @@ -7,8 +7,9 @@ //! Router helpers for injecting LSPS2 blinded payment paths. -use bitcoin::secp256k1::{self, PublicKey, Secp256k1}; +use std::sync::Arc; +use bitcoin::secp256k1::{self, PublicKey, Secp256k1}; use lightning::blinded_path::payment::{ BlindedPaymentPath, ForwardTlvs, PaymentConstraints, PaymentContext, PaymentForwardNode, PaymentRelay, ReceiveTlvs, @@ -22,13 +23,11 @@ use lightning::routing::router::{InFlightHtlcs, Route, RouteParameters, Router}; use lightning::sign::{EntropySource, ReceiveAuthKey}; use lightning::types::features::BlindedHopFeatures; use lightning::types::payment::PaymentHash; -use std::sync::Arc; +use super::LSPS2_MIN_FINAL_CLTV_EXPIRY_DELTA; use crate::payment::PaymentMetadata; use crate::types::Graph; -use super::LSPS2_MIN_FINAL_CLTV_EXPIRY_DELTA; - /// Parameters needed to construct an LSPS2 blinded payment path. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct LSPS2LeaseParameters { @@ -218,11 +217,11 @@ impl Router for LSPS2Router { #[cfg(test)] mod tests { - use super::*; + use core::sync::atomic::{AtomicUsize, Ordering}; + use std::collections::BTreeMap; use bitcoin::secp256k1::SecretKey; use bitcoin::Network; - use core::sync::atomic::{AtomicUsize, Ordering}; use lightning::blinded_path::payment::{Bolt12OfferContext, PaymentConstraints}; use lightning::ln::channel_state::{ ChannelCounterparty, ChannelShutdownState, CounterpartyForwardingInfo, @@ -233,8 +232,8 @@ mod tests { use lightning::offers::offer::OfferId; use lightning::types::features::{ChannelFeatures, InitFeatures}; use lightning::types::payment::PaymentSecret; - use std::collections::BTreeMap; + use super::*; use crate::logger::Logger; #[derive(Clone)] diff --git a/src/liquidity/client/lsps2/state.rs b/src/liquidity/client/lsps2/state.rs index 4030059047..cb105f37cc 100644 --- a/src/liquidity/client/lsps2/state.rs +++ b/src/liquidity/client/lsps2/state.rs @@ -36,17 +36,15 @@ use lightning_liquidity::lsps2::msgs::LSPS2OpeningFeeParams; use lightning_liquidity::lsps2::utils::compute_opening_fee; use tokio::sync::Mutex as AsyncMutex; +use super::LSPS2_MIN_FINAL_CLTV_EXPIRY_DELTA; use crate::data_store::{DataStore, StorableObject, StorableObjectId}; -use crate::hex_utils; use crate::io::{ LSPS2_CACHE_TARGET_PERSISTENCE_KEY, LSPS2_CACHE_TARGET_PERSISTENCE_PRIMARY_NAMESPACE, LSPS2_CACHE_TARGET_PERSISTENCE_SECONDARY_NAMESPACE, }; use crate::logger::{log_error, LdkLogger}; use crate::types::DynStore; -use crate::Error; - -use super::LSPS2_MIN_FINAL_CLTV_EXPIRY_DELTA; +use crate::{hex_utils, Error}; pub(crate) const MIN_CACHED_LEASE_REMAINING_SECS: u64 = 24 * 60 * 60; @@ -555,7 +553,6 @@ pub(crate) fn now_secs() -> u64 { mod tests { use std::sync::Arc; - use super::*; use bitcoin::secp256k1::{Secp256k1, SecretKey}; use lightning::io; use lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA; @@ -563,6 +560,7 @@ mod tests { use lightning::util::ser::{Readable, Writeable}; use lightning::util::test_utils::TestLogger; + use super::*; use crate::io::test_utils::InMemoryStore; use crate::io::{ LSPS2_CACHE_TARGET_PERSISTENCE_KEY, LSPS2_CACHE_TARGET_PERSISTENCE_PRIMARY_NAMESPACE, diff --git a/src/payment/bolt12/mod.rs b/src/payment/bolt12/mod.rs index 3b4883f597..72b2b3e7e8 100644 --- a/src/payment/bolt12/mod.rs +++ b/src/payment/bolt12/mod.rs @@ -11,8 +11,6 @@ mod offers; -pub(crate) use offers::NodeOffersMessageHandler; - use std::num::NonZeroU64; use std::sync::{Arc, RwLock}; use std::time::{Duration, SystemTime, UNIX_EPOCH}; @@ -30,6 +28,7 @@ use lightning::sign::{EntropySource, NodeSigner}; use lightning::util::ser::{Readable, Writeable}; use lightning_types::payment::PaymentPreimage; use lightning_types::string::UntrustedString; +pub(crate) use offers::NodeOffersMessageHandler; use crate::config::{AsyncPaymentsRole, Config}; use crate::connection::ConnectionManager; diff --git a/src/types.rs b/src/types.rs index 39935bd2ba..9c6b5c1f24 100644 --- a/src/types.rs +++ b/src/types.rs @@ -44,9 +44,9 @@ use crate::ffi::maybe_wrap; use crate::liquidity::client::lsps2::router::LSPS2Router; use crate::logger::Logger; use crate::message_handler::NodeCustomMessageHandler; -use crate::payment::NodeOffersMessageHandler; use crate::payment::{ - ChannelPairForwardingStats, ForwardedPaymentDetails, PaymentDetails, PendingPaymentDetails, + ChannelPairForwardingStats, ForwardedPaymentDetails, NodeOffersMessageHandler, PaymentDetails, + PendingPaymentDetails, }; use crate::runtime::RuntimeSpawner; use crate::wallet::provenance::ChannelTxFacts;