Rename SigHashTypeParseError -> SighashTypeParseError
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 `SigHashTypeParseError` to `SighashTypeParseError`.
This commit is contained in:
parent
6caba2ed24
commit
130e27349e
|
@ -778,7 +778,7 @@ impl fmt::Display for EcdsaSighashType {
|
|||
}
|
||||
|
||||
impl str::FromStr for EcdsaSighashType {
|
||||
type Err = SigHashTypeParseError;
|
||||
type Err = SighashTypeParseError;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
|
@ -788,7 +788,7 @@ impl str::FromStr for EcdsaSighashType {
|
|||
"SIGHASH_ALL|SIGHASH_ANYONECANPAY" => Ok(EcdsaSighashType::AllPlusAnyoneCanPay),
|
||||
"SIGHASH_NONE|SIGHASH_ANYONECANPAY" => Ok(EcdsaSighashType::NonePlusAnyoneCanPay),
|
||||
"SIGHASH_SINGLE|SIGHASH_ANYONECANPAY" => Ok(EcdsaSighashType::SinglePlusAnyoneCanPay),
|
||||
_ => Err(SigHashTypeParseError { unrecognized: s.to_owned() }),
|
||||
_ => Err(SighashTypeParseError { unrecognized: s.to_owned() }),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -875,12 +875,12 @@ impl EcdsaSighashType {
|
|||
///
|
||||
/// This is currently returned for unrecognized sighash strings.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SigHashTypeParseError {
|
||||
pub struct SighashTypeParseError {
|
||||
/// The unrecognized string we attempted to parse.
|
||||
pub unrecognized: String,
|
||||
}
|
||||
|
||||
impl fmt::Display for SigHashTypeParseError {
|
||||
impl fmt::Display for SighashTypeParseError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Unrecognized SIGHASH string '{}'", self.unrecognized)
|
||||
}
|
||||
|
@ -888,7 +888,7 @@ impl fmt::Display for SigHashTypeParseError {
|
|||
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
|
||||
#[cfg(feature = "std")]
|
||||
impl ::std::error::Error for SigHashTypeParseError {}
|
||||
impl ::std::error::Error for SighashTypeParseError {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
|
|
@ -20,7 +20,7 @@ use core::str::FromStr;
|
|||
use secp256k1;
|
||||
use blockdata::script::Script;
|
||||
use blockdata::witness::Witness;
|
||||
use blockdata::transaction::{Transaction, TxOut, NonStandardSigHashType, SigHashTypeParseError};
|
||||
use blockdata::transaction::{Transaction, TxOut, NonStandardSigHashType, SighashTypeParseError};
|
||||
use consensus::encode;
|
||||
use hashes::{self, hash160, ripemd160, sha256, sha256d};
|
||||
use secp256k1::XOnlyPublicKey;
|
||||
|
@ -167,7 +167,7 @@ impl fmt::Display for PsbtSigHashType {
|
|||
}
|
||||
|
||||
impl FromStr for PsbtSigHashType {
|
||||
type Err = SigHashTypeParseError;
|
||||
type Err = SighashTypeParseError;
|
||||
|
||||
#[inline]
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
|
@ -177,7 +177,7 @@ impl FromStr for PsbtSigHashType {
|
|||
// inputs. We also do not support SIGHASH_RESERVED in verbatim form
|
||||
// ("0xFF" string should be used instead).
|
||||
match SchnorrSighashType::from_str(s) {
|
||||
Ok(SchnorrSighashType::Reserved) => return Err(SigHashTypeParseError{ unrecognized: s.to_owned() }),
|
||||
Ok(SchnorrSighashType::Reserved) => return Err(SighashTypeParseError{ unrecognized: s.to_owned() }),
|
||||
Ok(ty) => return Ok(ty.into()),
|
||||
Err(_) => {}
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ impl FromStr for PsbtSigHashType {
|
|||
return Ok(PsbtSigHashType { inner });
|
||||
}
|
||||
|
||||
Err(SigHashTypeParseError{ unrecognized: s.to_owned() })
|
||||
Err(SighashTypeParseError{ unrecognized: s.to_owned() })
|
||||
}
|
||||
}
|
||||
impl From<EcdsaSighashType> for PsbtSigHashType {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
use prelude::*;
|
||||
|
||||
pub use blockdata::transaction::{EcdsaSighashType, SigHashTypeParseError};
|
||||
pub use blockdata::transaction::{EcdsaSighashType, SighashTypeParseError};
|
||||
use blockdata::witness::Witness;
|
||||
use consensus::{encode, Encodable};
|
||||
use core::{str, fmt};
|
||||
|
@ -148,7 +148,7 @@ impl fmt::Display for SchnorrSighashType {
|
|||
}
|
||||
|
||||
impl str::FromStr for SchnorrSighashType {
|
||||
type Err = SigHashTypeParseError;
|
||||
type Err = SighashTypeParseError;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
|
@ -160,7 +160,7 @@ impl str::FromStr for SchnorrSighashType {
|
|||
"SIGHASH_NONE|SIGHASH_ANYONECANPAY" => Ok(SchnorrSighashType::NonePlusAnyoneCanPay),
|
||||
"SIGHASH_SINGLE|SIGHASH_ANYONECANPAY" => Ok(SchnorrSighashType::SinglePlusAnyoneCanPay),
|
||||
"SIGHASH_RESERVED" => Ok(SchnorrSighashType::Reserved),
|
||||
_ => Err(SigHashTypeParseError{ unrecognized: s.to_owned() }),
|
||||
_ => Err(SighashTypeParseError{ unrecognized: s.to_owned() }),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue