This isn't a big difference in the API, but it avoids needing to
wrap a given NetworkGraph in a RwLock before passing it, which
makes it much easier to generate C bindings for.
use std::cell::RefCell;
use std::rc::Rc;
-use std::sync::{Mutex, RwLock};
+use std::sync::Mutex;
use std::mem;
use std::collections::HashMap;
let network_graph_deser = <NetworkGraph>::read(&mut ::std::io::Cursor::new(&w.0)).unwrap();
assert!(network_graph_deser == *self.net_graph_msg_handler.network_graph.read().unwrap());
let net_graph_msg_handler = NetGraphMsgHandler::from_net_graph(
- self.chain_monitor, self.logger, RwLock::new(network_graph_deser)
+ self.chain_monitor, self.logger, network_graph_deser
);
let mut chan_progress = 0;
loop {
/// Creates a new tracker of the actual state of the network of channels and nodes,
/// assuming an existing Network Graph.
- pub fn from_net_graph(chain_monitor: C, logger: L, network_graph: RwLock<NetworkGraph>) -> Self {
+ pub fn from_net_graph(chain_monitor: C, logger: L, network_graph: NetworkGraph) -> Self {
NetGraphMsgHandler {
secp_ctx: Secp256k1::verification_only(),
- network_graph,
+ network_graph: RwLock::new(network_graph),
full_syncs_requested: AtomicUsize::new(0),
chain_monitor,
logger,