pub struct BlockHeader {
    pub version: i32,
    pub prev_blockhash: BlockHash,
    pub merkle_root: TxMerkleNode,
    pub im_merkle_root: TxMerkleNode,
    pub time: u32,
    pub xfield: XField,
    pub proof: Option<Signature>,
}
Expand description

A block header, which contains all the block’s information except the actual transactions

Fields§

§version: i32

The protocol version. Should always be 1.

§prev_blockhash: BlockHash

Reference to the previous block in the chain

§merkle_root: TxMerkleNode

The root hash of the merkle tree of transactions in the block

§im_merkle_root: TxMerkleNode

MerkleRoot based on fixing malleability transaction hash

§time: u32

The timestamp of the block, as claimed by the miner

§xfield: XField

Extra field. This field can host any type of data defined in Tapyrus protocol.

§proof: Option<Signature>

Collection holds a signature for block hash which is consisted of block header without Proof.

Implementations§

source§

impl BlockHeader

source

pub fn block_hash(&self) -> BlockHash

Return the block hash.

source

pub fn aggregated_public_key(&self) -> Option<PublicKey>

Return the Aggregate public key in this BlockHeader

source

pub fn max_block_size(&self) -> Option<u32>

Return the max block size in this BlockHeader

source

pub fn signature_hash(&self) -> BlockSigHash

Computes a signature hash for this block. Tapyrus signer needs to sign this hash. The signature will be added to the block header as the proof field and submitted to the tapyrus node.

source

pub fn get_size(&self) -> usize

Return block header size

Trait Implementations§

source§

impl Clone for BlockHeader

source§

fn clone(&self) -> BlockHeader

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BlockHeader

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Decodable for BlockHeader

source§

fn consensus_decode<D: Read>(d: D) -> Result<BlockHeader, Error>

Decode an object with a well-defined format
source§

impl Encodable for BlockHeader

source§

fn consensus_encode<S: Write>(&self, s: S) -> Result<usize, Error>

Encode an object with a well-defined format, should only ever error if the underlying Write errors. Returns the number of bytes written on success
source§

impl PartialEq for BlockHeader

source§

fn eq(&self, other: &BlockHeader) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for BlockHeader

source§

impl StructuralEq for BlockHeader

source§

impl StructuralPartialEq for BlockHeader

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Az for T

source§

fn az<Dst>(self) -> Dstwhere T: Cast<Dst>,

Casts the value.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,

Casts the value.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,

Casts the value.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,

Casts the value.