Struct psbt::PsbtSighashType
source · pub struct PsbtSighashType { /* private fields */ }
Expand description
A Signature hash type for the corresponding input. As of taproot upgrade, the signature hash
type can be either EcdsaSighashType
or SchnorrSighashType
but it is not possible to know
directly which signature hash type the user is dealing with. Therefore, the user is responsible
for converting to/from PsbtSighashType
from/to the desired signature hash type they need.
Implementations§
source§impl PsbtSighashType
impl PsbtSighashType
sourcepub fn ecdsa_hash_ty(self) -> Result<EcdsaSighashType, NonStandardSighashType>
pub fn ecdsa_hash_ty(self) -> Result<EcdsaSighashType, NonStandardSighashType>
Returns the EcdsaSighashType
if the PsbtSighashType
can be
converted to one.
sourcepub fn schnorr_hash_ty(self) -> Result<SchnorrSighashType, Error>
pub fn schnorr_hash_ty(self) -> Result<SchnorrSighashType, Error>
Returns the SchnorrSighashType
if the PsbtSighashType
can be
converted to one.
sourcepub fn from_u32(n: u32) -> PsbtSighashType
pub fn from_u32(n: u32) -> PsbtSighashType
Creates a PsbtSighashType
from a raw u32
.
Allows construction of a non-standard or non-valid sighash flag
(EcdsaSighashType
, SchnorrSighashType
respectively).
sourcepub fn to_u32(self) -> u32
pub fn to_u32(self) -> u32
Converts PsbtSighashType
to a raw u32
sighash flag.
No guarantees are made as to the standardness or validity of the returned value.
Trait Implementations§
source§impl Clone for PsbtSighashType
impl Clone for PsbtSighashType
source§fn clone(&self) -> PsbtSighashType
fn clone(&self) -> PsbtSighashType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PsbtSighashType
impl Debug for PsbtSighashType
source§impl Deserialize for PsbtSighashType
impl Deserialize for PsbtSighashType
source§fn deserialize(bytes: &[u8]) -> Result<PsbtSighashType, Error>
fn deserialize(bytes: &[u8]) -> Result<PsbtSighashType, Error>
source§impl Display for PsbtSighashType
impl Display for PsbtSighashType
source§impl From<EcdsaSighashType> for PsbtSighashType
impl From<EcdsaSighashType> for PsbtSighashType
source§fn from(ecdsa_hash_ty: EcdsaSighashType) -> PsbtSighashType
fn from(ecdsa_hash_ty: EcdsaSighashType) -> PsbtSighashType
source§impl From<SchnorrSighashType> for PsbtSighashType
impl From<SchnorrSighashType> for PsbtSighashType
source§fn from(schnorr_hash_ty: SchnorrSighashType) -> PsbtSighashType
fn from(schnorr_hash_ty: SchnorrSighashType) -> PsbtSighashType
source§impl FromStr for PsbtSighashType
impl FromStr for PsbtSighashType
§type Err = SighashTypeParseError
type Err = SighashTypeParseError
source§fn from_str(
s: &str
) -> Result<PsbtSighashType, <PsbtSighashType as FromStr>::Err>
fn from_str(
s: &str
) -> Result<PsbtSighashType, <PsbtSighashType as FromStr>::Err>
s
to return a value of this type. Read moresource§impl Hash for PsbtSighashType
impl Hash for PsbtSighashType
source§impl Ord for PsbtSighashType
impl Ord for PsbtSighashType
source§fn cmp(&self, other: &PsbtSighashType) -> Ordering
fn cmp(&self, other: &PsbtSighashType) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<PsbtSighashType> for PsbtSighashType
impl PartialEq<PsbtSighashType> for PsbtSighashType
source§fn eq(&self, other: &PsbtSighashType) -> bool
fn eq(&self, other: &PsbtSighashType) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<PsbtSighashType> for PsbtSighashType
impl PartialOrd<PsbtSighashType> for PsbtSighashType
source§fn partial_cmp(&self, other: &PsbtSighashType) -> Option<Ordering>
fn partial_cmp(&self, other: &PsbtSighashType) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for PsbtSighashType
impl Serialize for PsbtSighashType
source§impl StrictDecode for PsbtSighashType
impl StrictDecode for PsbtSighashType
source§fn strict_decode<D>(d: D) -> Result<PsbtSighashType, Error>where
D: Read,
fn strict_decode<D>(d: D) -> Result<PsbtSighashType, Error>where
D: Read,
std::io::Read
instance; must either
construct an instance or return implementation-specific error type.source§fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
fn strict_deserialize(data: impl AsRef<[u8]>) -> Result<Self, Error>
StrictDecode::strict_decode
. If there are some data remains in the
buffer once deserialization is completed, fails with
Error::DataNotEntirelyConsumed
. Use io::Cursor
over the buffer and
StrictDecode::strict_decode
to avoid such failures.source§fn strict_file_load(path: impl AsRef<Path>) -> Result<Self, Error>
fn strict_file_load(path: impl AsRef<Path>) -> Result<Self, Error>
path
and reconstructs object from it. Fails
with Error::DataNotEntirelyConsumed
if file contains remaining
data after the object reconstruction.source§impl StrictEncode for PsbtSighashType
impl StrictEncode for PsbtSighashType
source§fn strict_encode<E>(&self, e: E) -> Result<usize, Error>where
E: Write,
fn strict_encode<E>(&self, e: E) -> Result<usize, Error>where
E: Write,
std::io::Write
instance; must return result
with either amount of bytes encoded – or implementation-specific
error type.source§fn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
fn strict_serialize(&self) -> Result<Vec<u8, Global>, Error>
StrictEncode::strict_encode
function