X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Frouting%2Fgossip.rs;fp=lightning%2Fsrc%2Frouting%2Fgossip.rs;h=1757d13730045f9d4246c18a0c150fbd668de412;hb=fc771d3b2042cfab0f60b2344089e789b461b6e7;hp=37bf1ea5a6f9757d1da5a29f636aa0a853f2de8e;hpb=b4521f52e29015b344f2acfe1ed8ed0cf95ff076;p=rust-lightning diff --git a/lightning/src/routing/gossip.rs b/lightning/src/routing/gossip.rs index 37bf1ea5..1757d137 100644 --- a/lightning/src/routing/gossip.rs +++ b/lightning/src/routing/gossip.rs @@ -1796,6 +1796,12 @@ impl ReadOnlyNetworkGraph<'_> { self.channels.get(&short_channel_id) } + #[cfg(c_bindings)] // Non-bindings users should use `channels` + /// Returns the list of channels in the graph + pub fn list_channels(&self) -> Vec { + self.channels.keys().map(|c| *c).collect() + } + /// Returns all known nodes' public keys along with announced node info. /// /// (C-not exported) because we have no mapping for `BTreeMap`s @@ -1808,6 +1814,12 @@ impl ReadOnlyNetworkGraph<'_> { self.nodes.get(node_id) } + #[cfg(c_bindings)] // Non-bindings users should use `nodes` + /// Returns the list of nodes in the graph + pub fn list_nodes(&self) -> Vec { + self.nodes.keys().map(|n| *n).collect() + } + /// Get network addresses by node id. /// Returns None if the requested node is completely unknown, /// or if node announcement for the node was never received.