Add a help message for the `keysend` command
[ldk-sample] / src / cli.rs
index d6ffa5d96f2edf818bd7fcfee07bc9aa42413c8a..6904180ddcc3d0e48f48787b00184aaaaec40f45 100644 (file)
@@ -321,8 +321,8 @@ pub(crate) async fn poll_for_user_input<E: EventHandler>(
                                                continue;
                                        }
                                        let channel_id_vec = hex_utils::to_vec(channel_id_str.unwrap());
-                                       if channel_id_vec.is_none() {
-                                               println!("ERROR: couldn't parse channel_id as hex");
+                                       if channel_id_vec.is_none() || channel_id_vec.as_ref().unwrap().len() != 32 {
+                                               println!("ERROR: couldn't parse channel_id");
                                                continue;
                                        }
                                        let mut channel_id = [0; 32];
@@ -336,8 +336,8 @@ pub(crate) async fn poll_for_user_input<E: EventHandler>(
                                                continue;
                                        }
                                        let channel_id_vec = hex_utils::to_vec(channel_id_str.unwrap());
-                                       if channel_id_vec.is_none() {
-                                               println!("ERROR: couldn't parse channel_id as hex");
+                                       if channel_id_vec.is_none() || channel_id_vec.as_ref().unwrap().len() != 32 {
+                                               println!("ERROR: couldn't parse channel_id");
                                                continue;
                                        }
                                        let mut channel_id = [0; 32];
@@ -369,6 +369,7 @@ pub(crate) async fn poll_for_user_input<E: EventHandler>(
 fn help() {
        println!("openchannel pubkey@host:port <amt_satoshis>");
        println!("sendpayment <invoice>");
+       println!("keysend <dest_pubkey> <amt_msat>");
        println!("getinvoice <amt_millisatoshis>");
        println!("connectpeer pubkey@host:port");
        println!("listchannels");