Remove explicit error conversion

We provide a `From<secp255k1::Error>` impl so we do not need to
explicitly convert the error return, just use `?`.
This commit is contained in:
Tobin C. Harding 2023-06-02 14:32:06 +10:00
parent d86517ae4f
commit 13d5c0536b
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ impl Signature {
64 => { 64 => {
// default type // default type
let sig = let sig =
secp256k1::schnorr::Signature::from_slice(sl).map_err(Error::Secp256k1)?; secp256k1::schnorr::Signature::from_slice(sl)?;
Ok(Signature { sig, hash_ty: TapSighashType::Default }) Ok(Signature { sig, hash_ty: TapSighashType::Default })
} }
65 => { 65 => {
@ -39,7 +39,7 @@ impl Signature {
let hash_ty = TapSighashType::from_consensus_u8(*hash_ty) let hash_ty = TapSighashType::from_consensus_u8(*hash_ty)
.map_err(|_| Error::InvalidSighashType(*hash_ty))?; .map_err(|_| Error::InvalidSighashType(*hash_ty))?;
let sig = let sig =
secp256k1::schnorr::Signature::from_slice(sig).map_err(Error::Secp256k1)?; secp256k1::schnorr::Signature::from_slice(sig)?;
Ok(Signature { sig, hash_ty }) Ok(Signature { sig, hash_ty })
} }
len => Err(Error::InvalidSignatureSize(len)), len => Err(Error::InvalidSignatureSize(len)),