Skip to content

Commit b967d87

Browse files
committed
fix(CI): fix CI build errors
1 parent 00ac430 commit b967d87

File tree

1 file changed

+33
-21
lines changed
  • lightning-background-processor/src

1 file changed

+33
-21
lines changed

lightning-background-processor/src/lib.rs

+33-21
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ pub async fn process_events_async<
763763
G,
764764
L,
765765
P,
766-
EH,
766+
EventHandler,
767767
PS,
768768
M,
769769
CM,
@@ -818,31 +818,41 @@ where
818818
event_handler(event).await
819819
})
820820
};
821+
// We should extract these out of config because the macro expects individual arguments
822+
let persister = config.persister;
823+
let chain_monitor = config.chain_monitor;
824+
let channel_manager = config.channel_manager;
825+
let onion_messenger = config.onion_messenger;
826+
let peer_manager = config.peer_manager;
827+
let gossip_sync = config.gossip_sync;
828+
let logger = config.logger;
829+
let scorer = config.scorer;
830+
821831
define_run_body!(
822-
config.persister,
823-
config.chain_monitor,
824-
config.chain_monitor.process_pending_events_async(async_event_handler).await,
825-
config.channel_manager,
826-
config.channel_manager.get_cm().process_pending_events_async(async_event_handler).await,
827-
config.onion_messenger,
828-
if let Some(om) = &config.onion_messenger {
832+
persister,
833+
chain_monitor,
834+
chain_monitor.process_pending_events_async(async_event_handler).await,
835+
channel_manager,
836+
channel_manager.get_cm().process_pending_events_async(async_event_handler).await,
837+
onion_messenger,
838+
if let Some(om) = &onion_messenger {
829839
om.get_om().process_pending_events_async(async_event_handler).await
830840
},
831-
config.peer_manager,
832-
config.gossip_sync,
833-
config.logger,
834-
config.scorer,
841+
peer_manager,
842+
gossip_sync,
843+
logger,
844+
scorer,
835845
should_break,
836846
{
837-
let om_fut = if let Some(om) = config.onion_messenger.as_ref() {
847+
let om_fut = if let Some(om) = onion_messenger.as_ref() {
838848
let fut = om.get_om().get_update_future();
839849
OptionalSelector { optional_future: Some(fut) }
840850
} else {
841851
OptionalSelector { optional_future: None }
842852
};
843853
let fut = Selector {
844-
a: config.channel_manager.get_cm().get_event_or_persistence_needed_future(),
845-
b: config.chain_monitor.get_update_future(),
854+
a: channel_manager.get_cm().get_event_or_persistence_needed_future(),
855+
b: chain_monitor.get_update_future(),
846856
c: om_fut,
847857
d: sleeper(if mobile_interruptable_platform {
848858
Duration::from_millis(100)
@@ -1209,7 +1219,7 @@ impl BackgroundProcessor {
12091219
/// process_events_async(config, sleeper, mobile_interruptable_platform, fetch_time).await?;"
12101220
)]
12111221
/// ```
1212-
#[cfg(feature = "std")]
1222+
#[cfg(any(feature = "std", feature = "futures"))]
12131223
pub struct BackgroundProcessorConfig<
12141224
'a,
12151225
UL: 'static + Deref + Send + Sync,
@@ -1346,7 +1356,7 @@ where
13461356
PM::Target: APeerManager + Send + Sync,
13471357
{
13481358
/// Creates a new builder instance.
1349-
pub(crate) fn new(
1359+
pub fn new(
13501360
persister: PS, event_handler: EH, chain_monitor: M, channel_manager: CM,
13511361
gossip_sync: GossipSync<PGS, RGS, G, UL, L>, peer_manager: PM, logger: L,
13521362
) -> Self {
@@ -1405,7 +1415,9 @@ impl Drop for BackgroundProcessor {
14051415

14061416
#[cfg(all(feature = "std", test))]
14071417
mod tests {
1408-
use super::{BackgroundProcessor, GossipSync, FRESHNESS_TIMER};
1418+
use super::{
1419+
BackgroundProcessor, BackgroundProcessorConfigBuilder, GossipSync, FRESHNESS_TIMER,
1420+
};
14091421
use bitcoin::constants::{genesis_block, ChainHash};
14101422
use bitcoin::hashes::Hash;
14111423
use bitcoin::locktime::absolute::LockTime;
@@ -3086,11 +3098,11 @@ mod tests {
30863098
}
30873099

30883100
#[test]
3089-
fn test_background_processor_builder() {
3101+
fn test_background_processor_config_builder() {
30903102
// Test that when a new channel is created, the ChannelManager needs to be re-persisted with
30913103
// updates. Also test that when new updates are available, the manager signals that it needs
30923104
// re-persistence and is successfully re-persisted.
3093-
let (persist_dir, nodes) = create_nodes(2, "test_background_processor_builder");
3105+
let (persist_dir, nodes) = create_nodes(2, "test_background_processor_config_builder");
30943106

30953107
// Go through the channel creation process so that each node has something to persist. Since
30963108
// open_channel consumes events, it must complete before starting BackgroundProcessor to
@@ -3164,7 +3176,7 @@ mod tests {
31643176
.unwrap();
31653177

31663178
// Check that the force-close updates are persisted
3167-
check_persisted_data!(nodes[0].node, manager_path.clone());
3179+
check_persisted_data!(nodes[0].node, filepath.clone());
31683180
loop {
31693181
if !nodes[0].node.get_event_or_persist_condvar_value() {
31703182
break;

0 commit comments

Comments
 (0)