Skip to content

Commit 11ee263

Browse files
WIP
1 parent 8db198c commit 11ee263

File tree

2 files changed

+24
-7
lines changed
  • lightning-background-processor/src
  • lightning-liquidity/src/lsps5

2 files changed

+24
-7
lines changed

lightning-background-processor/src/lib.rs

+19-4
Original file line numberDiff line numberDiff line change
@@ -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))]
11011103
mod 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,

lightning-liquidity/src/lsps5/event.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ use super::msgs::WebhookNotification;
2424
pub enum LSPS5ServiceEvent {
2525
/// A webhook was registered by a client
2626
///
27-
/// This event occurs when a client successfully registers a webhook via `lsps5.set_webhook`.
28-
/// You should store this information to be able to contact the client when they are offline.
27+
/// This event occurs when a client successfully registers or updates a webhook via [`lsps5.set_webhook`].
28+
/// [`lsps5.set_webhook`]: super::msgs::LSPS5Request::SetWebhook
2929
WebhookRegistered {
3030
/// Client node ID that registered the webhook.
3131
counterparty_node_id: PublicKey,
@@ -57,7 +57,9 @@ pub enum LSPS5ServiceEvent {
5757

5858
/// Webhooks were listed for a client.
5959
///
60-
/// This event occurs when a client requests their registered webhooks via `lsps5.list_webhooks`.
60+
/// This event occurs when a client requests their registered webhooks via [`lsps5.list_webhooks`].
61+
///
62+
/// [`lsps5.list_webhooks`]: super::msgs::LSPS5Request::ListWebhooks
6163
WebhooksListed {
6264
/// Client node ID that requested their webhooks.
6365
counterparty_node_id: PublicKey,

0 commit comments

Comments
 (0)