Enum bitcoin::blockdata::transaction::EcdsaSigHashType
source · [−]pub enum EcdsaSigHashType {
All,
None,
Single,
AllPlusAnyoneCanPay,
NonePlusAnyoneCanPay,
SinglePlusAnyoneCanPay,
}
Expand description
Hashtype of an input’s signature, encoded in the last byte of the signature.
Fixed values so they can be cast as integer types for encoding (see also
SchnorrSigHashType
).
Variants
All
0x1: Sign all outputs.
None
0x2: Sign no outputs — anyone can choose the destination.
Single
0x3: Sign the output whose index matches this input’s index. If none exists,
sign the hash 0000000000000000000000000000000000000000000000000000000000000001
.
(This rule is probably an unintentional C++ism, but it’s consensus so we have
to follow it.)
AllPlusAnyoneCanPay
0x81: Sign all outputs but only this input.
NonePlusAnyoneCanPay
0x82: Sign no outputs and only this input.
SinglePlusAnyoneCanPay
0x83: Sign one output and only this input (see Single
for what “one output” means).
Implementations
sourceimpl EcdsaSigHashType
impl EcdsaSigHashType
sourcepub fn from_u32_consensus(n: u32) -> EcdsaSigHashType
👎 Deprecated since 0.28.0: please use from_consensus
pub fn from_u32_consensus(n: u32) -> EcdsaSigHashType
please use from_consensus
Creates a EcdsaSigHashType
from a raw u32
.
sourcepub fn from_consensus(n: u32) -> EcdsaSigHashType
pub fn from_consensus(n: u32) -> EcdsaSigHashType
Creates a EcdsaSigHashType
from a raw u32
.
Note: this replicates consensus behaviour, for current standardness rules correctness
you probably want Self::from_standard
.
This might cause unexpected behavior because it does not roundtrip. That is,
EcdsaSigHashType::from_consensus(n) as u32 != n
for non-standard values of n
. While
verifying signatures, the user should retain the n
and use it compute the signature hash
message.
sourcepub fn from_u32_standard(
n: u32
) -> Result<EcdsaSigHashType, NonStandardSigHashType>
👎 Deprecated since 0.28.0: please use from_standard
pub fn from_u32_standard(
n: u32
) -> Result<EcdsaSigHashType, NonStandardSigHashType>
please use from_standard
Creates a EcdsaSigHashType
from a raw u32
.
sourcepub fn from_standard(n: u32) -> Result<EcdsaSigHashType, NonStandardSigHashType>
pub fn from_standard(n: u32) -> Result<EcdsaSigHashType, NonStandardSigHashType>
sourcepub fn to_u32(self) -> u32
pub fn to_u32(self) -> u32
Converts EcdsaSigHashType
to a u32
sighash flag.
The returned value is guaranteed to be a valid according to standardness rules.
Trait Implementations
sourceimpl Clone for EcdsaSigHashType
impl Clone for EcdsaSigHashType
sourcefn clone(&self) -> EcdsaSigHashType
fn clone(&self) -> EcdsaSigHashType
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for EcdsaSigHashType
impl Debug for EcdsaSigHashType
sourceimpl<'de> Deserialize<'de> for EcdsaSigHashType
This is supported on crate feature serde
only.
impl<'de> Deserialize<'de> for EcdsaSigHashType
serde
only.sourcefn deserialize<D>(deserializer: D) -> Result<EcdsaSigHashType, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<EcdsaSigHashType, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Display for EcdsaSigHashType
impl Display for EcdsaSigHashType
sourceimpl From<EcdsaSigHashType> for PsbtSigHashType
impl From<EcdsaSigHashType> for PsbtSigHashType
sourcefn from(ecdsa_hash_ty: EcdsaSigHashType) -> Self
fn from(ecdsa_hash_ty: EcdsaSigHashType) -> Self
Converts to this type from the input type.
sourceimpl From<EcdsaSigHashType> for SchnorrSigHashType
impl From<EcdsaSigHashType> for SchnorrSigHashType
sourcefn from(s: EcdsaSigHashType) -> Self
fn from(s: EcdsaSigHashType) -> Self
Converts to this type from the input type.
sourceimpl FromStr for EcdsaSigHashType
impl FromStr for EcdsaSigHashType
sourceimpl PartialEq<EcdsaSigHashType> for EcdsaSigHashType
impl PartialEq<EcdsaSigHashType> for EcdsaSigHashType
sourceimpl<'de> Serialize for EcdsaSigHashType
This is supported on crate feature serde
only.
impl<'de> Serialize for EcdsaSigHashType
serde
only.impl Copy for EcdsaSigHashType
impl Eq for EcdsaSigHashType
impl StructuralEq for EcdsaSigHashType
impl StructuralPartialEq for EcdsaSigHashType
Auto Trait Implementations
impl RefUnwindSafe for EcdsaSigHashType
impl Send for EcdsaSigHashType
impl Sync for EcdsaSigHashType
impl Unpin for EcdsaSigHashType
impl UnwindSafe for EcdsaSigHashType
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more