Don't support signed messages with p2wpkh addresses
This commit is contained in:
parent
f7422fb8d1
commit
3f65fb1aed
|
@ -156,11 +156,7 @@ mod message_signing {
|
||||||
*address == Address::p2pkh(&pubkey, address.network)
|
*address == Address::p2pkh(&pubkey, address.network)
|
||||||
}
|
}
|
||||||
Some(AddressType::P2sh) => false,
|
Some(AddressType::P2sh) => false,
|
||||||
Some(AddressType::P2wpkh) => {
|
Some(AddressType::P2wpkh) => false,
|
||||||
// Only compressed pubkeys are allowed in p2wpkh.
|
|
||||||
pubkey.compressed &&
|
|
||||||
*address == Address::p2wpkh(&pubkey, address.network).expect("compressed pk")
|
|
||||||
}
|
|
||||||
Some(AddressType::P2wsh) => false,
|
Some(AddressType::P2wsh) => false,
|
||||||
None => false,
|
None => false,
|
||||||
})
|
})
|
||||||
|
@ -323,7 +319,7 @@ mod tests {
|
||||||
let p2pkh = ::Address::p2pkh(&pubkey, ::Network::Bitcoin);
|
let p2pkh = ::Address::p2pkh(&pubkey, ::Network::Bitcoin);
|
||||||
assert_eq!(signature2.is_signed_by_address(&secp, &p2pkh, msg_hash), Ok(true));
|
assert_eq!(signature2.is_signed_by_address(&secp, &p2pkh, msg_hash), Ok(true));
|
||||||
let p2wpkh = ::Address::p2wpkh(&pubkey, ::Network::Bitcoin).unwrap();
|
let p2wpkh = ::Address::p2wpkh(&pubkey, ::Network::Bitcoin).unwrap();
|
||||||
assert_eq!(signature2.is_signed_by_address(&secp, &p2wpkh, msg_hash), Ok(true));
|
assert_eq!(signature2.is_signed_by_address(&secp, &p2wpkh, msg_hash), Ok(false));
|
||||||
let p2shwpkh = ::Address::p2shwpkh(&pubkey, ::Network::Bitcoin).unwrap();
|
let p2shwpkh = ::Address::p2shwpkh(&pubkey, ::Network::Bitcoin).unwrap();
|
||||||
assert_eq!(signature2.is_signed_by_address(&secp, &p2shwpkh, msg_hash), Ok(false));
|
assert_eq!(signature2.is_signed_by_address(&secp, &p2shwpkh, msg_hash), Ok(false));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue