X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-background-processor%2Fsrc%2Flib.rs;h=16c5eb4f9393193ba9136fd645661625946359e6;hb=7a8954e1ca318eecb4a03aa5f729d9d0ee9a904e;hp=4e6fb6f02dfdf7a2f43f21d9f176f5f528f270d3;hpb=35573bb3d7bf8c7f7b9d8759afa555aec2735a44;p=rust-lightning diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs index 4e6fb6f0..16c5eb4f 100644 --- a/lightning-background-processor/src/lib.rs +++ b/lightning-background-processor/src/lib.rs @@ -10,8 +10,7 @@ use lightning::chain; use lightning::chain::chaininterface::{BroadcasterInterface, FeeEstimator}; -use lightning::chain::chainmonitor::ChainMonitor; -use lightning::chain::channelmonitor; +use lightning::chain::chainmonitor::{ChainMonitor, Persist}; use lightning::chain::keysinterface::{Sign, KeysInterface}; use lightning::ln::channelmanager::ChannelManager; use lightning::ln::msgs::{ChannelMessageHandler, RoutingMessageHandler}; @@ -60,13 +59,15 @@ const FRESHNESS_TIMER: u64 = 60; #[cfg(test)] const FRESHNESS_TIMER: u64 = 1; -#[cfg(not(debug_assertions))] +#[cfg(all(not(test), not(debug_assertions)))] const PING_TIMER: u64 = 5; /// Signature operations take a lot longer without compiler optimisations. /// Increasing the ping timer allows for this but slower devices will be disconnected if the /// timeout is reached. -#[cfg(debug_assertions)] +#[cfg(all(not(test), debug_assertions))] const PING_TIMER: u64 = 30; +#[cfg(test)] +const PING_TIMER: u64 = 1; /// Trait which handles persisting a [`ChannelManager`] to disk. /// @@ -192,7 +193,7 @@ impl BackgroundProcessor { K::Target: 'static + KeysInterface, F::Target: 'static + FeeEstimator, L::Target: 'static + Logger, - P::Target: 'static + channelmonitor::Persist, + P::Target: 'static + Persist, CMH::Target: 'static + ChannelMessageHandler, RMH::Target: 'static + RoutingMessageHandler, UMH::Target: 'static + CustomMessageHandler, @@ -310,6 +311,7 @@ mod tests { use lightning::ln::features::InitFeatures; use lightning::ln::msgs::{ChannelMessageHandler, Init}; use lightning::ln::peer_handler::{PeerManager, MessageHandler, SocketDescriptor, IgnoringMessageHandler}; + use lightning::routing::scorer::Scorer; use lightning::routing::network_graph::{NetworkGraph, NetGraphMsgHandler}; use lightning::util::config::UserConfig; use lightning::util::events::{Event, MessageSendEventsProvider, MessageSendEvent}; @@ -614,6 +616,7 @@ mod tests { .expect("SpendableOutputs not handled within deadline"); match event { Event::SpendableOutputs { .. } => {}, + Event::ChannelClosed { .. } => {}, _ => panic!("Unexpected event: {:?}", event), }