fix from/into electum bug (#5686)

This commit is contained in:
Nikolay Volf 2017-05-24 12:53:02 +03:00 committed by Arkadiy Paronyan
parent 18c3e90dbf
commit 7499efecf6

View File

@ -54,7 +54,7 @@ impl Signature {
/// Parse bytes as a signature encoded as RSV (V in "Electrum" notation). /// Parse bytes as a signature encoded as RSV (V in "Electrum" notation).
/// May return empty (invalid) signature if given data has invalid length. /// May return empty (invalid) signature if given data has invalid length.
pub fn from_electrum(data: &[u8]) -> Self { pub fn from_electrum(data: &[u8]) -> Self {
if data.len() != 65 || data[0] < 27 { if data.len() != 65 || data[64] < 27 {
// fallback to empty (invalid) signature // fallback to empty (invalid) signature
return Signature::default(); return Signature::default();
} }