Skip to content

Commit 14f24ea

Browse files
committed
fix ci build errors
1 parent e6e9f29 commit 14f24ea

File tree

1 file changed

+13
-53
lines changed
  • lightning-background-processor/src

1 file changed

+13
-53
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 13 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ use lightning_liquidity::ALiquidityManager;
5151

5252
use core::ops::Deref;
5353
use core::time::Duration;
54+
use std::marker::PhantomData;
5455

5556
#[cfg(feature = "std")]
5657
use core::sync::atomic::{AtomicBool, Ordering};
@@ -64,9 +65,6 @@ use std::time::Instant;
6465
#[cfg(not(feature = "std"))]
6566
use alloc::boxed::Box;
6667

67-
#[cfg(feature = "std")]
68-
use std::marker::PhantomData;
69-
7068
/// `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
7169
/// Rust-Lightning running properly, and (2) either can or should be run in the background. Its
7270
/// responsibilities are:
@@ -1115,23 +1113,6 @@ impl BackgroundProcessor {
11151113
/// This method is functionally equivalent to [`BackgroundProcessor::start`], but takes a configuration
11161114
/// object instead of individual parameters.
11171115
///
1118-
/// # Example
1119-
/// ```
1120-
/// # use lightning_background_processor::*;
1121-
/// let mut builder = BackgroundProcessorConfigBuilder::new(
1122-
/// persister,
1123-
/// event_handler,
1124-
/// chain_monitor,
1125-
/// channel_manager,
1126-
/// gossip_sync,
1127-
/// peer_manager,
1128-
/// logger
1129-
/// );
1130-
/// builder.with_onion_messenger(messenger);
1131-
/// .with_scorer(scorer);
1132-
/// let config = builder.build();
1133-
/// let bg_processor = BackgroundProcessor::from_config(config);
1134-
/// ```
11351116
pub fn from_config<
11361117
'a,
11371118
UL: 'static + Deref + Send + Sync,
@@ -1155,7 +1136,7 @@ impl BackgroundProcessor {
11551136
S: 'static + Deref<Target = SC> + Send + Sync,
11561137
SC: for<'b> WriteableScore<'b>,
11571138
>(
1158-
config: BackgroundProcessorConfig<
1139+
#[rustfmt::skip] config: BackgroundProcessorConfig<
11591140
'a,
11601141
UL,
11611142
CF,
@@ -1265,32 +1246,6 @@ impl BackgroundProcessor {
12651246
/// * Running the async variant of the background processor via [`process_events_async`]"
12661247
)]
12671248
///
1268-
/// # Example
1269-
/// ```
1270-
/// # use lightning_background_processor::*;
1271-
/// let mut builder = BackgroundProcessorConfigBuilder::new(
1272-
/// persister,
1273-
/// event_handler,
1274-
/// chain_monitor,
1275-
/// channel_manager,
1276-
/// gossip_sync,
1277-
/// peer_manager,
1278-
/// logger
1279-
/// );
1280-
/// builder.with_onion_messenger(messenger); // Optional
1281-
/// .with_scorer(scorer); // Optional
1282-
/// let config = builder.build();
1283-
///
1284-
/// // Use with BackgroundProcessor
1285-
/// let processor = BackgroundProcessor::from_config(config);
1286-
///
1287-
#[cfg_attr(
1288-
feature = "futures",
1289-
doc = "
1290-
/// // Or use with async processing
1291-
/// process_events_async(config, sleeper, mobile_interruptable_platform, fetch_time).await?;"
1292-
)]
1293-
/// ```
12941249
#[cfg(any(feature = "std", feature = "futures"))]
12951250
pub struct BackgroundProcessorConfig<
12961251
'a,
@@ -1302,7 +1257,8 @@ pub struct BackgroundProcessorConfig<
13021257
L: 'static + Deref + Send + Sync,
13031258
P: 'static + Deref + Send + Sync,
13041259
#[cfg(feature = "std")] EH: 'static + EventHandler + Send,
1305-
#[cfg(feature = "futures")] EH: 'static + Fn(Event) -> core::future::Future<Output = Result<(), ReplayEvent>>,
1260+
#[cfg(feature = "futures")] EventHandlerFuture: core::future::Future<Output = Result<(), ReplayEvent>>,
1261+
#[cfg(feature = "futures")] EH: 'static + Fn(Event) -> EventHandlerFuture,
13061262
PS: 'static + Deref + Send,
13071263
M: 'static
13081264
+ Deref<Target = ChainMonitor<<CM::Target as AChannelManager>::Signer, CF, T, F, L, P>>
@@ -1344,7 +1300,7 @@ pub struct BackgroundProcessorConfig<
13441300
/// This builder provides a flexible and type-safe way to construct a [`BackgroundProcessorConfig`]
13451301
/// with optional components like `onion_messenger` and `scorer`. It helps avoid specifying
13461302
/// concrete types for components that aren't being used.
1347-
#[cfg(feature = "std")]
1303+
#[cfg(any(feature = "std", feature = "futures"))]
13481304
pub struct BackgroundProcessorConfigBuilder<
13491305
'a,
13501306
UL: 'static + Deref + Send + Sync,
@@ -1354,7 +1310,9 @@ pub struct BackgroundProcessorConfigBuilder<
13541310
G: 'static + Deref<Target = NetworkGraph<L>> + Send + Sync,
13551311
L: 'static + Deref + Send + Sync,
13561312
P: 'static + Deref + Send + Sync,
1357-
EH: 'static + EventHandler + Send,
1313+
#[cfg(feature = "std")] EH: 'static + EventHandler + Send,
1314+
#[cfg(feature = "futures")] EventHandlerFuture: core::future::Future<Output = Result<(), ReplayEvent>>,
1315+
#[cfg(feature = "futures")] EH: 'static + Fn(Event) -> EventHandlerFuture,
13581316
PS: 'static + Deref + Send,
13591317
M: 'static
13601318
+ Deref<Target = ChainMonitor<<CM::Target as AChannelManager>::Signer, CF, T, F, L, P>>
@@ -1391,7 +1349,7 @@ pub struct BackgroundProcessorConfigBuilder<
13911349
_phantom: PhantomData<(&'a (), CF, T, F, P)>,
13921350
}
13931351

1394-
#[cfg(feature = "std")]
1352+
#[cfg(any(feature = "std", feature = "futures"))]
13951353
impl<
13961354
'a,
13971355
UL: 'static + Deref + Send + Sync,
@@ -1401,7 +1359,9 @@ impl<
14011359
G: 'static + Deref<Target = NetworkGraph<L>> + Send + Sync,
14021360
L: 'static + Deref + Send + Sync,
14031361
P: 'static + Deref + Send + Sync,
1404-
EH: 'static + EventHandler + Send,
1362+
#[cfg(feature = "std")] EH: 'static + EventHandler + Send,
1363+
#[cfg(feature = "futures")] EventHandlerFuture: core::future::Future<Output = Result<(), ReplayEvent>>,
1364+
#[cfg(feature = "futures")] EH: 'static + Fn(Event) -> EventHandlerFuture,
14051365
PS: 'static + Deref + Send,
14061366
M: 'static
14071367
+ Deref<Target = ChainMonitor<<CM::Target as AChannelManager>::Signer, CF, T, F, L, P>>
@@ -3319,7 +3279,7 @@ mod tests {
33193279
// Check scorer is persisted
33203280
let filepath =
33213281
get_full_filepath(format!("{}_persister_0", &persist_dir), "scorer".to_string());
3322-
check_persisted_data!(nodes[0].scorer, filepath);
3282+
check_persisted_data!(nodes[0].scorer, filepath.clone());
33233283

33243284
if !std::thread::panicking() {
33253285
bg_processor.stop().unwrap();

0 commit comments

Comments
 (0)