Update docs with correct hash type
[rust-lightning] / lightning / src / routing / network_graph.rs
index ab32493351bd75d6970e8eb32b60d9b281d6965b..13dc662642c62ccd8aabc9affd520a9ad927bb2a 100644 (file)
@@ -45,7 +45,7 @@ use bitcoin::hashes::hex::ToHex;
 const MAX_EXCESS_BYTES_FOR_RELAY: usize = 1024;
 
 /// Represents the network as nodes and channels between them
-#[derive(PartialEq)]
+#[derive(Clone, PartialEq)]
 pub struct NetworkGraph {
        genesis_hash: BlockHash,
        channels: BTreeMap<u64, ChannelInfo>,
@@ -102,6 +102,13 @@ impl<C: Deref, L: Deref> NetGraphMsgHandler<C, L> where C::Target: chain::Access
                }
        }
 
+       /// Adds a provider used to check new announcements. Does not affect
+       /// existing announcements unless they are updated.
+       /// Add, update or remove the provider would replace the current one.
+       pub fn add_chain_access(&mut self, chain_access: Option<C>) {
+               self.chain_access = chain_access;
+       }
+
        /// Take a read lock on the network_graph and return it in the C-bindings
        /// newtype helper. This is likely only useful when called via the C
        /// bindings as you can call `self.network_graph.read().unwrap()` in Rust