@@ -67,25 +67,6 @@ impl NetGraphMsgHandler {
67
67
logger : logger. clone ( ) ,
68
68
}
69
69
}
70
-
71
- /// Get network addresses by node id.
72
- /// Returns None if the requested node is completely unknown,
73
- /// or if node announcement for the node was never received.
74
- pub fn get_addresses ( & self , pubkey : & PublicKey ) -> Option < Vec < NetAddress > > {
75
- let network = self . network_graph . read ( ) . unwrap ( ) ;
76
- if let Some ( node) = network. get_nodes ( ) . get ( pubkey) {
77
- if let Some ( node_info) = node. announcement_info . as_ref ( ) {
78
- return Some ( node_info. addresses . clone ( ) )
79
- }
80
- }
81
- None
82
- }
83
-
84
- /// Dumps the entire network view of this NetGraphMsgHandler to the logger provided in the constructor at
85
- /// level Trace
86
- pub fn trace_state ( & self ) {
87
- log_trace ! ( self , "{}" , self . network_graph. read( ) . unwrap( ) ) ;
88
- }
89
70
}
90
71
91
72
@@ -509,6 +490,18 @@ impl NetworkGraph {
509
490
/// Returns all known nodes' public keys along with announced node info.
510
491
pub fn get_nodes < ' a > ( & ' a self ) -> & ' a BTreeMap < PublicKey , NodeInfo > { & self . nodes }
511
492
493
+ /// Get network addresses by node id.
494
+ /// Returns None if the requested node is completely unknown,
495
+ /// or if node announcement for the node was never received.
496
+ pub fn get_addresses < ' a > ( & ' a self , pubkey : & PublicKey ) -> Option < & ' a Vec < NetAddress > > {
497
+ if let Some ( node) = self . nodes . get ( pubkey) {
498
+ if let Some ( node_info) = node. announcement_info . as_ref ( ) {
499
+ return Some ( & node_info. addresses )
500
+ }
501
+ }
502
+ None
503
+ }
504
+
512
505
/// For an already known node (from channel announcements), update its stored properties from a given node announcement
513
506
/// Announcement signatures are checked here only if Secp256k1 object is provided.
514
507
fn update_node_from_announcement ( & mut self , msg : & msgs:: NodeAnnouncement , secp_ctx : Option < & Secp256k1 < secp256k1:: VerifyOnly > > ) -> Result < bool , LightningError > {
0 commit comments