pub enum Header {
Stock(StockHeader),
Blake2bV2(Blake2bV2Header),
}Expand description
A header of either family, with the operations a sidestr validator needs dispatched to the right one.
Variants§
Implementations§
Source§impl Header
impl Header
Sourcepub const fn family(&self) -> HeaderFamily
pub const fn family(&self) -> HeaderFamily
Which family this header belongs to.
Sourcepub const fn prev_block_hash(&self) -> BlockHash
pub const fn prev_block_hash(&self) -> BlockHash
The previous block’s hash.
Sourcepub const fn merkle_root(&self) -> [u8; 32]
pub const fn merkle_root(&self) -> [u8; 32]
The merkle root, wire order.
Sourcepub fn time(&self) -> u32
pub fn time(&self) -> u32
The consensus block time (for v2, with the offset applied when flagged).
Sourcepub const fn height(&self) -> Option<u32>
pub const fn height(&self) -> Option<u32>
The committed height: a v2 header carries it, a stock header does not
(siding’s blockHeight then reads the coinbase’s BIP 34 push, which
is sidestr-core’s job).
Sourcepub fn hash(&self) -> BlockHash
pub fn hash(&self) -> BlockHash
The block hash — the family’s proof-of-work hash, display order.
Sourcepub fn encode(&self) -> EncodedHeader
pub fn encode(&self) -> EncodedHeader
The wire bytes.
Sourcepub fn meets_target(&self) -> bool
pub fn meets_target(&self) -> bool
hash ≤ target(bits).
Sourcepub fn check_pow(&self, pow_limit: &Target) -> Result<(), Error>
pub fn check_pow(&self, pow_limit: &Target) -> Result<(), Error>
SPEC 4 step 1 against the chain document’s powLimit; see
check_pow.
Trait Implementations§
impl Copy for Header
impl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnsafeUnpin for Header
impl UnwindSafe for Header
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
Mutably borrows from an owned value. Read more
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§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
Compare self to
key and return true if they are equal.