Skip to content

Commit

Permalink
Merge pull request #112 from TheBlueMatt/main
Browse files Browse the repository at this point in the history
Trim whitespace when signing messages
  • Loading branch information
TheBlueMatt committed Aug 14, 2023
2 parents 34a748c + 55dc47f commit d69af92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
);
Expand Down

0 comments on commit d69af92

Please sign in to comment.