@@ -648,7 +648,7 @@ use futures_util::{dummy_waker, OptionalSelector, Selector, SelectorOutput};
648
648
/// # use std::sync::atomic::{AtomicBool, Ordering};
649
649
/// # use std::time::SystemTime;
650
650
/// # use lightning_background_processor::{process_events_async, GossipSync};
651
- /// # use lightning_liquidity::lsps5::service::TimeProvider ;
651
+ /// # use lightning_liquidity::lsps5::service::DefaultTimeProvider ;
652
652
/// # struct Logger {}
653
653
/// # impl lightning::util::logger::Logger for Logger {
654
654
/// # fn log(&self, _record: lightning::util::logger::Record) {}
@@ -661,15 +661,6 @@ use futures_util::{dummy_waker, OptionalSelector, Selector, SelectorOutput};
661
661
/// # fn list(&self, primary_namespace: &str, secondary_namespace: &str) -> io::Result<Vec<String>> { Ok(Vec::new()) }
662
662
/// # }
663
663
/// #
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
- /// # }
673
664
/// # struct EventHandler {}
674
665
/// # impl EventHandler {
675
666
/// # async fn handle_event(&self, _: lightning::events::Event) -> Result<(), ReplayEvent> { Ok(()) }
@@ -1162,7 +1153,7 @@ impl Drop for BackgroundProcessor {
1162
1153
}
1163
1154
}
1164
1155
1165
- #[ cfg( all( feature = "std" , test) ) ]
1156
+ #[ cfg( all( feature = "std" , feature = "time" , test) ) ]
1166
1157
mod tests {
1167
1158
use super :: { BackgroundProcessor , GossipSync , FRESHNESS_TIMER } ;
1168
1159
use bitcoin:: constants:: { genesis_block, ChainHash } ;
@@ -1207,7 +1198,7 @@ mod tests {
1207
1198
use lightning:: util:: sweep:: { OutputSpendStatus , OutputSweeperSync , PRUNE_DELAY_BLOCKS } ;
1208
1199
use lightning:: util:: test_utils;
1209
1200
use lightning:: { get_event, get_event_msg} ;
1210
- use lightning_liquidity:: lsps5:: service:: TimeProvider ;
1201
+ use lightning_liquidity:: lsps5:: service:: DefaultTimeProvider ;
1211
1202
use lightning_liquidity:: LiquidityManager ;
1212
1203
use lightning_persister:: fs_store:: FilesystemStore ;
1213
1204
use lightning_rapid_gossip_sync:: RapidGossipSync ;
@@ -1650,16 +1641,6 @@ mod tests {
1650
1641
path. to_str ( ) . unwrap ( ) . to_string ( )
1651
1642
}
1652
1643
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
-
1663
1644
fn create_nodes ( num_nodes : usize , persist_dir : & str ) -> ( String , Vec < Node > ) {
1664
1645
let persist_temp_path = env:: temp_dir ( ) . join ( persist_dir) ;
1665
1646
let persist_dir = persist_temp_path. to_string_lossy ( ) . to_string ( ) ;
@@ -1761,15 +1742,13 @@ mod tests {
1761
1742
Arc :: clone ( & logger) ,
1762
1743
Arc :: clone ( & keys_manager) ,
1763
1744
) ) ;
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 (
1766
1746
Arc :: clone ( & keys_manager) ,
1767
1747
Arc :: clone ( & manager) ,
1768
1748
None ,
1769
1749
None ,
1770
1750
None ,
1771
1751
None ,
1772
- time_provider,
1773
1752
) ) ;
1774
1753
let node = Node {
1775
1754
node : manager,
0 commit comments