@@ -648,7 +648,7 @@ use futures_util::{dummy_waker, OptionalSelector, Selector, SelectorOutput};
648648/// # use std::sync::atomic::{AtomicBool, Ordering};
649649/// # use std::time::SystemTime;
650650/// # use lightning_background_processor::{process_events_async, GossipSync};
651- /// # use lightning_liquidity::lsps5::service::TimeProvider ;
651+ /// # use lightning_liquidity::lsps5::service::DefaultTimeProvider ;
652652/// # struct Logger {}
653653/// # impl lightning::util::logger::Logger for Logger {
654654/// # fn log(&self, _record: lightning::util::logger::Record) {}
@@ -661,15 +661,6 @@ use futures_util::{dummy_waker, OptionalSelector, Selector, SelectorOutput};
661661/// # fn list(&self, primary_namespace: &str, secondary_namespace: &str) -> io::Result<Vec<String>> { Ok(Vec::new()) }
662662/// # }
663663/// #
664- /// # use core::time::Duration;
665- /// # struct DefaultTimeProvider;
666- /// #
667- /// # impl TimeProvider for DefaultTimeProvider {
668- /// # fn duration_since_epoch(&self) -> Duration {
669- /// # use std::time::{SystemTime, UNIX_EPOCH};
670- /// # SystemTime::now().duration_since(UNIX_EPOCH).expect("system time before Unix epoch")
671- /// # }
672- /// # }
673664/// # struct EventHandler {}
674665/// # impl EventHandler {
675666/// # async fn handle_event(&self, _: lightning::events::Event) -> Result<(), ReplayEvent> { Ok(()) }
@@ -1162,7 +1153,7 @@ impl Drop for BackgroundProcessor {
11621153 }
11631154}
11641155
1165- #[ cfg( all( feature = "std" , test) ) ]
1156+ #[ cfg( all( feature = "std" , feature = "time" , test) ) ]
11661157mod tests {
11671158 use super :: { BackgroundProcessor , GossipSync , FRESHNESS_TIMER } ;
11681159 use bitcoin:: constants:: { genesis_block, ChainHash } ;
@@ -1207,7 +1198,7 @@ mod tests {
12071198 use lightning:: util:: sweep:: { OutputSpendStatus , OutputSweeperSync , PRUNE_DELAY_BLOCKS } ;
12081199 use lightning:: util:: test_utils;
12091200 use lightning:: { get_event, get_event_msg} ;
1210- use lightning_liquidity:: lsps5:: service:: TimeProvider ;
1201+ use lightning_liquidity:: lsps5:: service:: DefaultTimeProvider ;
12111202 use lightning_liquidity:: LiquidityManager ;
12121203 use lightning_persister:: fs_store:: FilesystemStore ;
12131204 use lightning_rapid_gossip_sync:: RapidGossipSync ;
@@ -1650,16 +1641,6 @@ mod tests {
16501641 path. to_str ( ) . unwrap ( ) . to_string ( )
16511642 }
16521643
1653- pub struct DefaultTimeProvider ;
1654-
1655- #[ cfg( feature = "std" ) ]
1656- impl TimeProvider for DefaultTimeProvider {
1657- fn duration_since_epoch ( & self ) -> Duration {
1658- use std:: time:: { SystemTime , UNIX_EPOCH } ;
1659- SystemTime :: now ( ) . duration_since ( UNIX_EPOCH ) . expect ( "system time before Unix epoch" )
1660- }
1661- }
1662-
16631644 fn create_nodes ( num_nodes : usize , persist_dir : & str ) -> ( String , Vec < Node > ) {
16641645 let persist_temp_path = env:: temp_dir ( ) . join ( persist_dir) ;
16651646 let persist_dir = persist_temp_path. to_string_lossy ( ) . to_string ( ) ;
@@ -1761,15 +1742,13 @@ mod tests {
17611742 Arc :: clone ( & logger) ,
17621743 Arc :: clone ( & keys_manager) ,
17631744 ) ) ;
1764- let time_provider = Arc :: new ( DefaultTimeProvider ) ;
1765- let liquidity_manager = Arc :: new ( LiquidityManager :: new_with_custom_time_provider (
1745+ let liquidity_manager = Arc :: new ( LiquidityManager :: new (
17661746 Arc :: clone ( & keys_manager) ,
17671747 Arc :: clone ( & manager) ,
17681748 None ,
17691749 None ,
17701750 None ,
17711751 None ,
1772- time_provider,
17731752 ) ) ;
17741753 let node = Node {
17751754 node : manager,
0 commit comments