File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed
Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ interface Node {
4747 [Throws=NodeError]
4848 Invoice receive_variable_amount_payment([ByRef]string description, u32 expiry_secs);
4949 PaymentInfo? payment_info([ByRef]PaymentHash payment_hash);
50+ sequence<PublicKey> list_peers();
5051};
5152
5253[Error]
Original file line number Diff line number Diff line change @@ -1176,6 +1176,14 @@ impl Node {
11761176 pub fn payment_info ( & self , payment_hash : & PaymentHash ) -> Option < PaymentInfo > {
11771177 self . payment_store . get ( payment_hash)
11781178 }
1179+
1180+ /// List node's connected peers.
1181+ pub fn list_peers ( & self ) -> Vec < PublicKey > {
1182+ self . peer_manager . get_peer_node_ids ( )
1183+ . iter ( )
1184+ . map ( |( pubkey, _) | * pubkey)
1185+ . collect :: < Vec < _ > > ( )
1186+ }
11791187}
11801188
11811189async fn connect_peer_if_necessary (
Original file line number Diff line number Diff line change @@ -183,6 +183,8 @@ fn channel_full_cycle() {
183183 let node_b_addr = format ! ( "{}@{}" , node_b. node_id( ) , node_b. listening_address( ) . unwrap( ) ) ;
184184 node_a. connect_open_channel ( & node_b_addr, 50000 , true ) . unwrap ( ) ;
185185
186+ assert_eq ! ( node_a. list_peers( ) , [ node_b. node_id( ) ] ) ;
187+
186188 let funding_txo = loop {
187189 let details = node_a. list_channels ( ) ;
188190
You can’t perform that action at this time.
0 commit comments