Merge pull request #1543 from jkczyz/2022-06-network-graph-bindings
[rust-lightning] / lightning / src / routing / gossip.rs
index 716ca2b305f3a48da3b5c698c571b11fed2fcdd0..b03acfb8970fc07dc6c8eefdb98251348fd62746 100644 (file)
@@ -1649,6 +1649,11 @@ impl ReadOnlyNetworkGraph<'_> {
                &*self.channels
        }
 
+       /// Returns information on a channel with the given id.
+       pub fn channel(&self, short_channel_id: u64) -> Option<&ChannelInfo> {
+               self.channels.get(&short_channel_id)
+       }
+
        /// Returns all known nodes' public keys along with announced node info.
        ///
        /// (C-not exported) because we have no mapping for `BTreeMap`s
@@ -1656,6 +1661,11 @@ impl ReadOnlyNetworkGraph<'_> {
                &*self.nodes
        }
 
+       /// Returns information on a node with the given id.
+       pub fn node(&self, node_id: &NodeId) -> Option<&NodeInfo> {
+               self.nodes.get(node_id)
+       }
+
        /// 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.