From: Matt Corallo <649246+TheBlueMatt@users.noreply.github.com> Date: Mon, 14 Aug 2023 16:51:47 +0000 (+0000) Subject: Merge pull request #112 from TheBlueMatt/main X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=d69af92ec08c03204796cecb35f6905374af785e;hp=34a748c1e5b7ace1904eaec80d56f20e8be81ec4;p=ldk-sample Merge pull request #112 from TheBlueMatt/main Trim whitespace when signing messages --- diff --git a/src/cli.rs b/src/cli.rs index 8e96fd8..a53a020 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -368,14 +368,14 @@ pub(crate) async fn poll_for_user_input( "listpeers" => list_peers(peer_manager.clone()), "signmessage" => { const MSG_STARTPOS: usize = "signmessage".len() + 1; - if line.as_bytes().len() <= MSG_STARTPOS { + if line.trim().as_bytes().len() <= MSG_STARTPOS { println!("ERROR: signmsg requires a message"); continue; } println!( "{:?}", lightning::util::message_signing::sign( - &line.as_bytes()[MSG_STARTPOS..], + &line.trim().as_bytes()[MSG_STARTPOS..], &keys_manager.get_node_secret_key() ) );