@@ -230,7 +230,8 @@ impl<
230230 G ,
231231 & ' a ( dyn UtxoLookup + Send + Sync ) ,
232232 L ,
233- > where
233+ >
234+ where
234235 L :: Target : Logger ,
235236{
236237 /// Initializes a new [`GossipSync::Rapid`] variant.
@@ -247,7 +248,8 @@ impl<'a, L: Deref>
247248 & ' a NetworkGraph < L > ,
248249 & ' a ( dyn UtxoLookup + Send + Sync ) ,
249250 L ,
250- > where
251+ >
252+ where
251253 L :: Target : Logger ,
252254{
253255 /// Initializes a new [`GossipSync::None`] variant.
@@ -1097,7 +1099,7 @@ impl Drop for BackgroundProcessor {
10971099 }
10981100}
10991101
1100- #[ cfg( all( feature = "std" , feature = "time" , test) ) ]
1102+ #[ cfg( all( feature = "std" , test) ) ]
11011103mod tests {
11021104 use super :: { BackgroundProcessor , GossipSync , FRESHNESS_TIMER } ;
11031105 use bitcoin:: constants:: { genesis_block, ChainHash } ;
@@ -1142,6 +1144,7 @@ mod tests {
11421144 use lightning:: util:: sweep:: { OutputSpendStatus , OutputSweeper , PRUNE_DELAY_BLOCKS } ;
11431145 use lightning:: util:: test_utils;
11441146 use lightning:: { get_event, get_event_msg} ;
1147+ use lightning_liquidity:: lsps5:: service:: TimeProvider ;
11451148 use lightning_liquidity:: LiquidityManager ;
11461149 use lightning_persister:: fs_store:: FilesystemStore ;
11471150 use lightning_rapid_gossip_sync:: RapidGossipSync ;
@@ -1578,6 +1581,16 @@ mod tests {
15781581 path. to_str ( ) . unwrap ( ) . to_string ( )
15791582 }
15801583
1584+ pub struct DefaultTimeProvider ;
1585+
1586+ #[ cfg( feature = "std" ) ]
1587+ impl TimeProvider for DefaultTimeProvider {
1588+ fn duration_since_epoch ( & self ) -> Duration {
1589+ use std:: time:: { SystemTime , UNIX_EPOCH } ;
1590+ SystemTime :: now ( ) . duration_since ( UNIX_EPOCH ) . expect ( "system time before Unix epoch" )
1591+ }
1592+ }
1593+
15811594 fn create_nodes ( num_nodes : usize , persist_dir : & str ) -> ( String , Vec < Node > ) {
15821595 let persist_temp_path = env:: temp_dir ( ) . join ( persist_dir) ;
15831596 let persist_dir = persist_temp_path. to_string_lossy ( ) . to_string ( ) ;
@@ -1676,13 +1689,15 @@ mod tests {
16761689 logger. clone ( ) ,
16771690 keys_manager. clone ( ) ,
16781691 ) ) ;
1679- let liquidity_manager = Arc :: new ( LiquidityManager :: new (
1692+ let time_provider = Arc :: new ( DefaultTimeProvider ) ;
1693+ let liquidity_manager = Arc :: new ( LiquidityManager :: new_with_custom_time_provider (
16801694 Arc :: clone ( & keys_manager) ,
16811695 Arc :: clone ( & manager) ,
16821696 None ,
16831697 None ,
16841698 None ,
16851699 None ,
1700+ time_provider,
16861701 ) ) ;
16871702 let node = Node {
16881703 node : manager,
0 commit comments