pub struct Header {
pub parent_hash: Hash,
pub number: BlockNumber,
pub timestamp: Timestamp,
pub state_root: Hash,
pub extrinsics_root: Hash,
pub digest: Vec<Vec<u8>>,
pub author: AccountId,
pub epoch: u32,
pub slot: u32,
}Expand description
JAM block header
Fields§
§parent_hash: HashHash of the parent block
number: BlockNumberBlock number (height in the chain)
timestamp: TimestampBlock timestamp (milliseconds since Unix epoch)
state_root: HashState root hash after applying this block
extrinsics_root: HashHash of extrinsics/transactions root
digest: Vec<Vec<u8>>Additional header data and proofs
Block author
epoch: u32Current epoch
slot: u32Slot within epoch
Implementations§
Source§impl Header
impl Header
Sourcepub fn new(
parent_hash: Hash,
number: BlockNumber,
timestamp: Timestamp,
state_root: Hash,
extrinsics_root: Hash,
author: AccountId,
epoch: u32,
slot: u32,
) -> Self
pub fn new( parent_hash: Hash, number: BlockNumber, timestamp: Timestamp, state_root: Hash, extrinsics_root: Hash, author: AccountId, epoch: u32, slot: u32, ) -> Self
Create a new header
Sourcepub fn is_genesis(&self) -> bool
pub fn is_genesis(&self) -> bool
Check if this is a genesis block header
Sourcepub fn encoded_size(&self) -> usize
pub fn encoded_size(&self) -> usize
Get encoded size of the header
Sourcepub fn verify_basic(&self) -> PrimitiveResult<()>
pub fn verify_basic(&self) -> PrimitiveResult<()>
Verify the header is well-formed
Sourcepub fn verify_against_parent(&self, parent: &Header) -> PrimitiveResult<()>
pub fn verify_against_parent(&self, parent: &Header) -> PrimitiveResult<()>
Verify header against parent
Trait Implementations§
Source§impl Decode for Header
impl Decode for Header
Source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Attempt to deserialise the value from input.
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
Source§impl<'de> Deserialize<'de> for Header
impl<'de> Deserialize<'de> for Header
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Encode for Header
impl Encode for Header
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
Source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
Source§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
impl EncodeLike 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