Struct tapyrus::blockdata::block::BlockHeader
source · 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
impl BlockHeader
sourcepub fn block_hash(&self) -> BlockHash
pub fn block_hash(&self) -> BlockHash
Return the block hash.
sourcepub fn aggregated_public_key(&self) -> Option<PublicKey>
pub fn aggregated_public_key(&self) -> Option<PublicKey>
Return the Aggregate public key in this BlockHeader
sourcepub fn max_block_size(&self) -> Option<u32>
pub fn max_block_size(&self) -> Option<u32>
Return the max block size in this BlockHeader
sourcepub fn signature_hash(&self) -> BlockSigHash
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.
Trait Implementations§
source§impl Clone for BlockHeader
impl Clone for BlockHeader
source§fn clone(&self) -> BlockHeader
fn clone(&self) -> BlockHeader
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BlockHeader
impl Debug for BlockHeader
source§impl Decodable for BlockHeader
impl Decodable for BlockHeader
source§fn consensus_decode<D: Read>(d: D) -> Result<BlockHeader, Error>
fn consensus_decode<D: Read>(d: D) -> Result<BlockHeader, Error>
source§impl Encodable for BlockHeader
impl Encodable for BlockHeader
source§impl PartialEq for BlockHeader
impl PartialEq for BlockHeader
source§fn eq(&self, other: &BlockHeader) -> bool
fn eq(&self, other: &BlockHeader) -> bool
self
and other
values to be equal, and is used
by ==
.