X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Frouting%2Fnetwork_graph.rs;h=13dc662642c62ccd8aabc9affd520a9ad927bb2a;hb=1a8b9be5e432fe43b778292f530a8a09062999c8;hp=4c5e718fed162d66fca028f98392e0f51d23b4d7;hpb=09f37ae89b9417899edd3b47bc7445787e843ebf;p=rust-lightning diff --git a/lightning/src/routing/network_graph.rs b/lightning/src/routing/network_graph.rs index 4c5e718f..13dc6626 100644 --- a/lightning/src/routing/network_graph.rs +++ b/lightning/src/routing/network_graph.rs @@ -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, @@ -102,6 +102,13 @@ impl NetGraphMsgHandler 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) { + 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 @@ -335,7 +342,7 @@ where } } -#[derive(Clone, PartialEq, Debug)] +#[derive(Clone, Debug, PartialEq)] /// Details about one direction of a channel. Received /// within a channel update. pub struct DirectionalChannelInfo { @@ -376,7 +383,7 @@ impl_writeable!(DirectionalChannelInfo, 0, { last_update_message }); -#[derive(PartialEq)] +#[derive(Clone, Debug, PartialEq)] /// Details about a channel (both directions). /// Received within a channel announcement. pub struct ChannelInfo { @@ -447,7 +454,7 @@ impl Writeable for RoutingFees { } } -#[derive(Clone, PartialEq, Debug)] +#[derive(Clone, Debug, PartialEq)] /// Information received in the latest node_announcement from this node. pub struct NodeAnnouncementInfo { /// Protocol features the node announced support for @@ -513,7 +520,7 @@ impl Readable for NodeAnnouncementInfo { } } -#[derive(Clone, PartialEq)] +#[derive(Clone, Debug, PartialEq)] /// Details about a node in the network, known from the network announcement. pub struct NodeInfo { /// All valid channels a node has announced