Skip to content

Commit b464db3

Browse files
committed
error message updated and peer_by_node_id used
1 parent 3d3bcc8 commit b464db3

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/cli.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,8 @@ pub(crate) fn poll_for_user_input(
9494
let pubkey = pubkey.unwrap();
9595

9696
if peer_addr_str.is_none() {
97-
let mut peer_connected = false;
98-
for peer_details in peer_manager.list_peers() {
99-
if peer_details.counterparty_node_id == pubkey {
100-
peer_connected = true;
101-
break;
102-
}
103-
}
104-
if peer_connected == false {
105-
println!("ERROR: Peer address not provided");
97+
if peer_manager.peer_by_node_id(&pubkey).is_none() {
98+
println!("ERROR: Peer address not provided and peer is not connected");
10699
continue;
107100
}
108101
} else {
@@ -525,8 +518,7 @@ fn help() {
525518
println!(" help\tShows a list of commands.");
526519
println!(" quit\tClose the application.");
527520
println!("\n Channels:");
528-
println!(" openchannel pubkey@host:port <amt_satoshis> [--public] [--with-anchors]");
529-
println!(" openchannel pubkey <amt_satoshis> [--public] [--with-anchors]");
521+
println!(" openchannel pubkey@[host:port] <amt_satoshis> [--public] [--with-anchors]");
530522
println!(" closechannel <channel_id> <peer_pubkey>");
531523
println!(" forceclosechannel <channel_id> <peer_pubkey>");
532524
println!(" listchannels");

0 commit comments

Comments
 (0)