mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 07:17:40 +01:00
Merge pull request #1010 from sr-gi/enforce_signature_length
This commit is contained in:
commit
ef4bfdca3c
1 changed files with 5 additions and 0 deletions
|
@ -36,6 +36,11 @@ fn sigrec_encode(sig_rec: RecoverableSignature) -> Vec<u8> {
|
|||
}
|
||||
|
||||
fn sigrec_decode(sig_rec: Vec<u8>) -> Result<RecoverableSignature, Error> {
|
||||
// Signature must be 64 + 1 bytes long (compact signature + recovery id)
|
||||
if sig_rec.len() != 65 {
|
||||
return Err(Error::InvalidSignature);
|
||||
}
|
||||
|
||||
let rsig = &sig_rec[1..];
|
||||
let rid = sig_rec[0] as i32 - 31;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue