Skip to content

Commit 61c6436

Browse files
committed
Add a second variant of ReadOnlyNetworkGraph::get_addresses for C
We cannot expose ReadOnlyNetworkGraph::get_addresses in C as it returns a list of references to an enum, which the bindings dont support. Instead, we add a second `#[doc(hidden)]` variant which the C bindings will expose (and document).
1 parent d665748 commit 61c6436

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lightning/src/routing/network_graph.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,6 +1223,19 @@ impl ReadOnlyNetworkGraph<'_> {
12231223
}
12241224
None
12251225
}
1226+
1227+
#[doc(hidden)] // Note that this will be ignored in C bindings generation
1228+
/// Get network addresses by node id.
1229+
/// Returns None if the requested node is completely unknown,
1230+
/// or if node announcement for the node was never received.
1231+
pub fn get_node_addresses(&self, pubkey: &PublicKey) -> Option<Vec<NetAddress>> {
1232+
if let Some(node) = self.nodes.get(&NodeId::from_pubkey(&pubkey)) {
1233+
if let Some(node_info) = node.announcement_info.as_ref() {
1234+
return Some(node_info.addresses.clone())
1235+
}
1236+
}
1237+
None
1238+
}
12261239
}
12271240

12281241
#[cfg(test)]

0 commit comments

Comments
 (0)