]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Sign gossip messages without grinding low R signatures
authorWilmer Paulino <wilmer@wilmerpaulino.com>
Wed, 19 Apr 2023 22:11:34 +0000 (15:11 -0700)
committerWilmer Paulino <wilmer@wilmerpaulino.com>
Thu, 20 Apr 2023 19:14:24 +0000 (12:14 -0700)
Gossip messages always use signatures in their compact form, so grinding
for low R signatures is unnecessary.

lightning/src/chain/keysinterface.rs

index f291f4c8151da43e84840271d66d314f242f07fa..b1290708b95f70a71ebf6193cceb1677aa3150bd 100644 (file)
@@ -928,7 +928,7 @@ impl EcdsaChannelSigner for InMemorySigner {
                &self, msg: &UnsignedChannelAnnouncement, secp_ctx: &Secp256k1<secp256k1::All>
        ) -> Result<Signature, ()> {
                let msghash = hash_to_message!(&Sha256dHash::hash(&msg.encode()[..])[..]);
-               Ok(sign(secp_ctx, &msghash, &self.funding_key))
+               Ok(secp_ctx.sign_ecdsa(&msghash, &self.funding_key))
        }
 }
 
@@ -1335,7 +1335,7 @@ impl NodeSigner for KeysManager {
 
        fn sign_gossip_message(&self, msg: UnsignedGossipMessage) -> Result<Signature, ()> {
                let msg_hash = hash_to_message!(&Sha256dHash::hash(&msg.encode()[..])[..]);
-               Ok(sign(&self.secp_ctx, &msg_hash, &self.node_secret))
+               Ok(self.secp_ctx.sign_ecdsa(&msg_hash, &self.node_secret))
        }
 }