Skip to content

Commit 2144166

Browse files
authored
Merge pull request #1115 from TheBlueMatt/2021-10-expose-addr-vec
Expose ReadOnlyNetworkGraph::get_addresses to C by cloning result
2 parents fe8c10d + d2b7f6c commit 2144166

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lightning/src/routing/network_graph.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1213,12 +1213,10 @@ impl ReadOnlyNetworkGraph<'_> {
12131213
/// Get network addresses by node id.
12141214
/// Returns None if the requested node is completely unknown,
12151215
/// or if node announcement for the node was never received.
1216-
///
1217-
/// (C-not exported) as there is no practical way to track lifetimes of returned values.
1218-
pub fn get_addresses(&self, pubkey: &PublicKey) -> Option<&Vec<NetAddress>> {
1216+
pub fn get_addresses(&self, pubkey: &PublicKey) -> Option<Vec<NetAddress>> {
12191217
if let Some(node) = self.nodes.get(&NodeId::from_pubkey(&pubkey)) {
12201218
if let Some(node_info) = node.announcement_info.as_ref() {
1221-
return Some(&node_info.addresses)
1219+
return Some(node_info.addresses.clone())
12221220
}
12231221
}
12241222
None

0 commit comments

Comments
 (0)