pub struct SighashType(pub u8);Expand description
SIGHASH types for transaction signature verification
IMPORTANT: The enum values match the canonical sighash bytes used in sighash computation. Early Bitcoin allowed sighash type 0x00 (treated as SIGHASH_ALL behavior), which we Wraps the raw sighash byte from the signature, preserving its exact value for preimage serialization. consensus uses the raw byte directly in the sighash preimage — before STRICTENC activation (BIP66), ANY sighash byte was accepted. The base type is determined by masking with 0x1f: NONE=2, SINGLE=3, else ALL.
Tuple Fields§
§0: u8Implementations§
Source§impl SighashType
impl SighashType
pub const ALL_LEGACY: SighashType
pub const ALL: SighashType
pub const NONE: SighashType
pub const SINGLE: SighashType
pub const ALL_ANYONECANPAY: SighashType
pub const NONE_ANYONECANPAY: SighashType
pub const SINGLE_ANYONECANPAY: SighashType
Sourcepub fn from_byte(byte: u8) -> SighashType
pub fn from_byte(byte: u8) -> SighashType
Create from raw sighash byte — accepts ANY value (pre-STRICTENC compatibility).
consensus determines behavior from byte & 0x1f and uses the raw byte in the preimage.
Sourcepub fn base_type(&self) -> u8
pub fn base_type(&self) -> u8
Base sighash type (lower 5 bits), matching consensus’s nHashType & 0x1f
Sourcepub fn is_anyonecanpay(&self) -> bool
pub fn is_anyonecanpay(&self) -> bool
Whether ANYONECANPAY flag is set (bit 7)
Trait Implementations§
Source§impl Clone for SighashType
impl Clone for SighashType
Source§fn clone(&self) -> SighashType
fn clone(&self) -> SighashType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SighashType
impl Debug for SighashType
Source§impl Hash for SighashType
impl Hash for SighashType
Source§impl PartialEq for SighashType
impl PartialEq for SighashType
impl Copy for SighashType
impl Eq for SighashType
impl StructuralPartialEq for SighashType
Auto Trait Implementations§
impl Freeze for SighashType
impl RefUnwindSafe for SighashType
impl Send for SighashType
impl Sync for SighashType
impl Unpin for SighashType
impl UnsafeUnpin for SighashType
impl UnwindSafe for SighashType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more