}
impl DelayedPaymentOutputDescriptor {
/// The maximum length a well-formed witness spending one of these should have.
+ /// Note: If you have the grind_signatures feature enabled, this will be at least 1 byte
+ /// shorter.
// Calculated as 1 byte length + 73 byte signature, 1 byte empty vec push, 1 byte length plus
// redeemscript push length.
pub const MAX_WITNESS_LENGTH: usize = 1 + 73 + 1 + chan_utils::REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH + 1;
}
impl StaticPaymentOutputDescriptor {
/// The maximum length a well-formed witness spending one of these should have.
+ /// Note: If you have the grind_signatures feature enabled, this will be at least 1 byte
+ /// shorter.
// Calculated as 1 byte legnth + 73 byte signature, 1 byte empty vec push, 1 byte length plus
// redeemscript push length.
pub const MAX_WITNESS_LENGTH: usize = 1 + 73 + 34;
&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))
}
}
witness: Witness::new(),
});
witness_weight += StaticPaymentOutputDescriptor::MAX_WITNESS_LENGTH;
+ #[cfg(feature = "grind_signatures")]
+ { witness_weight -= 1; } // Guarantees a low R signature
input_value += descriptor.output.value;
if !output_set.insert(descriptor.outpoint) { return Err(()); }
},
witness: Witness::new(),
});
witness_weight += DelayedPaymentOutputDescriptor::MAX_WITNESS_LENGTH;
+ #[cfg(feature = "grind_signatures")]
+ { witness_weight -= 1; } // Guarantees a low R signature
input_value += descriptor.output.value;
if !output_set.insert(descriptor.outpoint) { return Err(()); }
},
witness: Witness::new(),
});
witness_weight += 1 + 73 + 34;
+ #[cfg(feature = "grind_signatures")]
+ { witness_weight -= 1; } // Guarantees a low R signature
input_value += output.value;
if !output_set.insert(*outpoint) { return Err(()); }
}
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))
}
}