use lightning::routing::utxo::UtxoLookup;
use lightning::routing::router::Router;
use lightning::routing::scoring::{Score, WriteableScore};
-use lightning::util::events::{Event, EventHandler, EventsProvider, PathFailure};
+use lightning::util::events::{Event, PathFailure};
+#[cfg(feature = "std")]
+use lightning::util::events::{EventHandler, EventsProvider};
use lightning::util::logger::Logger;
use lightning::util::persist::Persister;
use lightning_rapid_gossip_sync::RapidGossipSync;
}
}
-/// (C-not exported) as the bindings concretize everything and have constructors for us
+/// This is not exported to bindings users as the bindings concretize everything and have constructors for us
impl<P: Deref<Target = P2PGossipSync<G, U, L>>, G: Deref<Target = NetworkGraph<L>>, U: Deref, L: Deref>
GossipSync<P, &RapidGossipSync<G, L>, G, U, L>
where
}
}
-/// (C-not exported) as the bindings concretize everything and have constructors for us
+/// This is not exported to bindings users as the bindings concretize everything and have constructors for us
impl<'a, R: Deref<Target = RapidGossipSync<G, L>>, G: Deref<Target = NetworkGraph<L>>, L: Deref>
GossipSync<
&P2PGossipSync<G, &'a (dyn UtxoLookup + Send + Sync), L>,
}
}
-/// (C-not exported) as the bindings concretize everything and have constructors for us
+/// This is not exported to bindings users as the bindings concretize everything and have constructors for us
impl<'a, L: Deref>
GossipSync<
&P2PGossipSync<&'a NetworkGraph<L>, &'a (dyn UtxoLookup + Send + Sync), L>,
log_error!($logger, "Error: Failed to persist network graph, check your disk and permissions {}", e)
}
- last_prune_call = $get_timer(NETWORK_PRUNE_TIMER);
have_pruned = true;
}
+ last_prune_call = $get_timer(NETWORK_PRUNE_TIMER);
}
if $timer_elapsed(&mut last_scorer_persist_call, SCORER_PERSIST_TIMER) {
impl Persister {
fn new(data_dir: String) -> Self {
- let filesystem_persister = FilesystemPersister::new(data_dir.clone());
+ let filesystem_persister = FilesystemPersister::new(data_dir);
Self { graph_error: None, graph_persistence_notifier: None, manager_error: None, scorer_error: None, filesystem_persister }
}
}
fn expect(&mut self, expectation: TestResult) {
- self.event_expectations.get_or_insert_with(|| VecDeque::new()).push_back(expectation);
+ self.event_expectations.get_or_insert_with(VecDeque::new).push_back(expectation);
}
}
// Set up a background event handler for SpendableOutputs events.
let (sender, receiver) = std::sync::mpsc::sync_channel(1);
let event_handler = move |event: Event| match event {
- Event::SpendableOutputs { .. } => sender.send(event.clone()).unwrap(),
+ Event::SpendableOutputs { .. } => sender.send(event).unwrap(),
Event::ChannelReady { .. } => {},
Event::ChannelClosed { .. } => {},
_ => panic!("Unexpected event: {:?}", event),
let nodes = create_nodes(2, "test_not_pruning_network_graph_until_graph_sync_completion".to_string());
let data_dir = nodes[0].persister.get_data_dir();
let (sender, receiver) = std::sync::mpsc::sync_channel(1);
- let persister = Arc::new(Persister::new(data_dir.clone()).with_graph_persistence_notifier(sender));
+ let persister = Arc::new(Persister::new(data_dir).with_graph_persistence_notifier(sender));
let network_graph = nodes[0].network_graph.clone();
let features = ChannelFeatures::empty();
network_graph.add_channel_from_partial_announcement(42, 53, features, nodes[0].node.get_our_node_id(), nodes[1].node.get_our_node_id())
// this should have added two channels
assert_eq!(network_graph.read_only().channels().len(), 3);
- let _ = receiver
+ receiver
.recv_timeout(Duration::from_secs(super::FIRST_NETWORK_PRUNE_TIMER * 5))
.expect("Network graph not pruned within deadline");
let nodes = create_nodes(1, "test_payment_path_scoring".to_string());
let data_dir = nodes[0].persister.get_data_dir();
- let persister = Arc::new(Persister::new(data_dir.clone()));
+ let persister = Arc::new(Persister::new(data_dir));
let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].no_gossip_sync(), nodes[0].peer_manager.clone(), nodes[0].logger.clone(), Some(nodes[0].scorer.clone()));
let scored_scid = 4242;
failure: PathFailure::OnPath { network_update: None },
path: path.clone(),
short_channel_id: Some(scored_scid),
- retry: None,
});
let event = receiver
.recv_timeout(Duration::from_secs(EVENT_DEADLINE))
failure: PathFailure::OnPath { network_update: None },
path: path.clone(),
short_channel_id: None,
- retry: None,
});
let event = receiver
.recv_timeout(Duration::from_secs(EVENT_DEADLINE))
nodes[0].node.push_pending_event(Event::ProbeFailed {
payment_id: PaymentId([42; 32]),
payment_hash: PaymentHash([42; 32]),
- path: path.clone(),
+ path,
short_channel_id: Some(scored_scid),
});
let event = receiver