Rename InvalidSigHashType -> InvalidSighashType
Our usage of `SigHash` implies that 'sighash' is _two_ words; 'sighash' is a well known word in the Bitcoin ecosystem it should appear in identifiers as `Sighash`. Rename the `InvalidSigHashType` variant to `InvalidSighashType`.
This commit is contained in:
parent
b84f25584e
commit
52b711c084
|
@ -214,7 +214,7 @@ impl PsbtSighashType {
|
||||||
/// converted to one.
|
/// converted to one.
|
||||||
pub fn schnorr_hash_ty(self) -> Result<SchnorrSighashType, sighash::Error> {
|
pub fn schnorr_hash_ty(self) -> Result<SchnorrSighashType, sighash::Error> {
|
||||||
if self.inner > 0xffu32 {
|
if self.inner > 0xffu32 {
|
||||||
Err(sighash::Error::InvalidSigHashType(self.inner))
|
Err(sighash::Error::InvalidSighashType(self.inner))
|
||||||
} else {
|
} else {
|
||||||
SchnorrSighashType::from_u8(self.inner as u8)
|
SchnorrSighashType::from_u8(self.inner as u8)
|
||||||
}
|
}
|
||||||
|
@ -601,6 +601,6 @@ mod test {
|
||||||
|
|
||||||
assert_eq!(back, sighash);
|
assert_eq!(back, sighash);
|
||||||
assert_eq!(back.ecdsa_hash_ty(), Err(NonStandardSighashType(nonstd)));
|
assert_eq!(back.ecdsa_hash_ty(), Err(NonStandardSighashType(nonstd)));
|
||||||
assert_eq!(back.schnorr_hash_ty(), Err(sighash::Error::InvalidSigHashType(nonstd)));
|
assert_eq!(back.schnorr_hash_ty(), Err(sighash::Error::InvalidSighashType(nonstd)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ pub enum Error {
|
||||||
WrongAnnex,
|
WrongAnnex,
|
||||||
|
|
||||||
/// Invalid Sighash type
|
/// Invalid Sighash type
|
||||||
InvalidSigHashType(u32),
|
InvalidSighashType(u32),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
|
@ -217,7 +217,7 @@ impl fmt::Display for Error {
|
||||||
Error::PrevoutIndex => write!(f, "The index requested is greater than available prevouts or different from the provided [Provided::Anyone] index"),
|
Error::PrevoutIndex => write!(f, "The index requested is greater than available prevouts or different from the provided [Provided::Anyone] index"),
|
||||||
Error::PrevoutKind => write!(f, "A single prevout has been provided but all prevouts are needed without `ANYONECANPAY`"),
|
Error::PrevoutKind => write!(f, "A single prevout has been provided but all prevouts are needed without `ANYONECANPAY`"),
|
||||||
Error::WrongAnnex => write!(f, "Annex must be at least one byte long and the first bytes must be `0x50`"),
|
Error::WrongAnnex => write!(f, "Annex must be at least one byte long and the first bytes must be `0x50`"),
|
||||||
Error::InvalidSigHashType(hash_ty) => write!(f, "Invalid schnorr Signature hash type : {} ", hash_ty),
|
Error::InvalidSighashType(hash_ty) => write!(f, "Invalid schnorr Signature hash type : {} ", hash_ty),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ impl SchnorrSighashType {
|
||||||
0x82 => Ok(SchnorrSighashType::NonePlusAnyoneCanPay),
|
0x82 => Ok(SchnorrSighashType::NonePlusAnyoneCanPay),
|
||||||
0x83 => Ok(SchnorrSighashType::SinglePlusAnyoneCanPay),
|
0x83 => Ok(SchnorrSighashType::SinglePlusAnyoneCanPay),
|
||||||
0xFF => Ok(SchnorrSighashType::Reserved),
|
0xFF => Ok(SchnorrSighashType::Reserved),
|
||||||
x => Err(Error::InvalidSigHashType(x as u32)),
|
x => Err(Error::InvalidSighashType(x as u32)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue