Update secp256k1 dependency
Update our `rust-secp256k1` dependency to the latest version. Requires doing: - Add a new variant to `Error` for the case where parity of the internal key is an invalid value (not 0 or 1). - Use non-deprecated const
This commit is contained in:
parent
337caad880
commit
d68531d815
|
@ -36,7 +36,7 @@ rustdoc-args = ["--cfg", "docsrs"]
|
|||
[dependencies]
|
||||
bech32 = { version = "0.8.1", default-features = false }
|
||||
bitcoin_hashes = { version = "0.10.0", default-features = false }
|
||||
secp256k1 = { version = "0.21.2", default-features = false }
|
||||
secp256k1 = { version = "0.22.0", default-features = false }
|
||||
core2 = { version = "0.3.0", optional = true, default-features = false }
|
||||
|
||||
base64-compat = { version = "1.0.0", optional = true }
|
||||
|
@ -47,7 +47,7 @@ hashbrown = { version = "0.8", optional = true }
|
|||
[dev-dependencies]
|
||||
serde_json = "<1.0.45"
|
||||
serde_test = "1"
|
||||
secp256k1 = { version = "0.21.2", features = [ "recovery", "rand-std" ] }
|
||||
secp256k1 = { version = "0.22.0", features = [ "recovery", "rand-std" ] }
|
||||
bincode = "1.3.1"
|
||||
# We need to pin ryu (transitive dep from serde_json) to stay compatible with Rust 1.22.0
|
||||
ryu = "<1.0.5"
|
||||
|
|
|
@ -174,7 +174,7 @@ impl TweakedPublicKey {
|
|||
/// the y-coordinate is represented by only a single bit, as x determines
|
||||
/// it up to one bit.
|
||||
#[inline]
|
||||
pub fn serialize(&self) -> [u8; constants::SCHNORRSIG_PUBLIC_KEY_SIZE] {
|
||||
pub fn serialize(&self) -> [u8; constants::SCHNORR_PUBLIC_KEY_SIZE] {
|
||||
self.0.serialize()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -682,7 +682,8 @@ impl ControlBlock {
|
|||
{
|
||||
return Err(TaprootError::InvalidControlBlockSize(sl.len()));
|
||||
}
|
||||
let output_key_parity = secp256k1::Parity::from((sl[0] & 1) as i32);
|
||||
let output_key_parity = secp256k1::Parity::from_i32((sl[0] & 1) as i32)
|
||||
.map_err(TaprootError::InvalidParity)?;
|
||||
let leaf_version = LeafVersion::from_consensus(sl[0] & TAPROOT_LEAF_MASK)?;
|
||||
let internal_key = UntweakedPublicKey::from_slice(&sl[1..TAPROOT_CONTROL_BASE_SIZE])
|
||||
.map_err(TaprootError::InvalidInternalKey)?;
|
||||
|
@ -970,6 +971,8 @@ pub enum TaprootError {
|
|||
InvalidControlBlockSize(usize),
|
||||
/// Invalid taproot internal key
|
||||
InvalidInternalKey(secp256k1::Error),
|
||||
/// Invalid parity for internal key
|
||||
InvalidParity(secp256k1::InvalidParityValue),
|
||||
/// Empty TapTree
|
||||
EmptyTree,
|
||||
}
|
||||
|
@ -999,6 +1002,7 @@ impl fmt::Display for TaprootError {
|
|||
),
|
||||
// TODO: add source when in MSRV
|
||||
TaprootError::InvalidInternalKey(e) => write!(f, "Invalid Internal XOnly key : {}", e),
|
||||
TaprootError::InvalidParity(e) => write!(f, "Invalid parity value for internal key: {}", e),
|
||||
TaprootError::EmptyTree => write!(f, "Taproot Tree must contain at least one script"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue