Skip to content

Commit d69af92

Browse files
authored
Merge pull request #112 from TheBlueMatt/main
Trim whitespace when signing messages
2 parents 34a748c + 55dc47f commit d69af92

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,14 @@ pub(crate) async fn poll_for_user_input(
368368
"listpeers" => list_peers(peer_manager.clone()),
369369
"signmessage" => {
370370
const MSG_STARTPOS: usize = "signmessage".len() + 1;
371-
if line.as_bytes().len() <= MSG_STARTPOS {
371+
if line.trim().as_bytes().len() <= MSG_STARTPOS {
372372
println!("ERROR: signmsg requires a message");
373373
continue;
374374
}
375375
println!(
376376
"{:?}",
377377
lightning::util::message_signing::sign(
378-
&line.as_bytes()[MSG_STARTPOS..],
378+
&line.trim().as_bytes()[MSG_STARTPOS..],
379379
&keys_manager.get_node_secret_key()
380380
)
381381
);

0 commit comments

Comments
 (0)