pub enum BlockHeader {
    BlockHeaderV1(Arc<BlockHeaderV1>),
    BlockHeaderV2(Arc<BlockHeaderV2>),
    BlockHeaderV3(Arc<BlockHeaderV3>),
    BlockHeaderV4(Arc<BlockHeaderV4>),
}
Expand description

Versioned BlockHeader data structure. For each next version, document what are the changes between versions.

Variants§

§

BlockHeaderV1(Arc<BlockHeaderV1>)

§

BlockHeaderV2(Arc<BlockHeaderV2>)

§

BlockHeaderV3(Arc<BlockHeaderV3>)

§

BlockHeaderV4(Arc<BlockHeaderV4>)

Implementations§

source§

impl BlockHeader

source

pub fn compute_inner_hash(inner_lite: &[u8], inner_rest: &[u8]) -> CryptoHash

source

pub fn compute_hash( prev_hash: CryptoHash, inner_lite: &[u8], inner_rest: &[u8] ) -> CryptoHash

source

pub fn new( this_epoch_protocol_version: ProtocolVersion, next_epoch_protocol_version: ProtocolVersion, height: BlockHeight, prev_hash: CryptoHash, block_body_hash: CryptoHash, prev_state_root: MerkleHash, prev_chunk_outgoing_receipts_root: MerkleHash, chunk_headers_root: MerkleHash, chunk_tx_root: MerkleHash, outcome_root: MerkleHash, timestamp: u64, challenges_root: MerkleHash, random_value: CryptoHash, prev_validator_power_proposals: Vec<ValidatorPower>, prev_validator_pledge_proposals: Vec<ValidatorPledge>, chunk_mask: Vec<bool>, block_ordinal: NumBlocks, epoch_id: EpochId, next_epoch_id: EpochId, next_gas_price: Balance, total_supply: Balance, challenges_result: ChallengesResult, signer: &dyn ValidatorSigner, last_final_block: CryptoHash, last_ds_final_block: CryptoHash, epoch_sync_data_hash: Option<CryptoHash>, approvals: Vec<Option<Box<Signature>>>, next_bp_hash: CryptoHash, block_merkle_root: CryptoHash, prev_height: BlockHeight ) -> Self

source

pub fn genesis( genesis_protocol_version: ProtocolVersion, height: BlockHeight, state_root: MerkleHash, block_body_hash: CryptoHash, prev_chunk_outgoing_receipts_root: MerkleHash, chunk_headers_root: MerkleHash, chunk_tx_root: MerkleHash, num_shards: u64, challenges_root: MerkleHash, timestamp: DateTime<Utc>, initial_gas_price: Balance, initial_total_supply: Balance, next_bp_hash: CryptoHash ) -> Self

source

pub fn hash(&self) -> &CryptoHash

source

pub fn prev_hash(&self) -> &CryptoHash

source

pub fn signature(&self) -> &Signature

source

pub fn height(&self) -> BlockHeight

source

pub fn prev_height(&self) -> Option<BlockHeight>

source

pub fn epoch_id(&self) -> &EpochId

source

pub fn next_epoch_id(&self) -> &EpochId

source

pub fn prev_state_root(&self) -> &MerkleHash

source

pub fn prev_chunk_outgoing_receipts_root(&self) -> &MerkleHash

source

pub fn chunk_headers_root(&self) -> &MerkleHash

source

pub fn chunk_tx_root(&self) -> &MerkleHash

source

pub fn chunks_included(&self) -> u64

source

pub fn challenges_root(&self) -> &MerkleHash

source

pub fn outcome_root(&self) -> &MerkleHash

source

pub fn block_body_hash(&self) -> Option<CryptoHash>

source

pub fn raw_timestamp(&self) -> u64

source

pub fn prev_validator_power_proposals(&self) -> ValidatorPowerIter<'_>

source

pub fn prev_validator_pledge_proposals(&self) -> ValidatorPledgeIter<'_>

source

pub fn chunk_mask(&self) -> &[bool]

source

pub fn block_ordinal(&self) -> NumBlocks

source

pub fn next_gas_price(&self) -> Balance

source

pub fn total_supply(&self) -> Balance

source

pub fn random_value(&self) -> &CryptoHash

source

pub fn last_final_block(&self) -> &CryptoHash

source

pub fn last_ds_final_block(&self) -> &CryptoHash

source

pub fn challenges_result(&self) -> &ChallengesResult

source

pub fn next_bp_hash(&self) -> &CryptoHash

source

pub fn block_merkle_root(&self) -> &CryptoHash

source

pub fn epoch_sync_data_hash(&self) -> Option<CryptoHash>

source

pub fn approvals(&self) -> &[Option<Box<Signature>>]

source

pub fn verify_block_producer(&self, public_key: &PublicKey) -> bool

Verifies that given public key produced the block.

source

pub fn timestamp(&self) -> DateTime<Utc>

source

pub fn num_approvals(&self) -> u64

source

pub fn verify_chunks_included(&self) -> bool

source

pub fn latest_protocol_version(&self) -> u32

source

pub fn inner_lite_bytes(&self) -> Vec<u8>

source

pub fn inner_rest_bytes(&self) -> Vec<u8>

source§

impl BlockHeader

source

pub fn get_mut(&mut self) -> &mut BlockHeaderV4

source

pub fn set_latest_protocol_version( &mut self, latest_protocol_version: ProtocolVersion )

source

pub fn resign(&mut self, signer: &dyn ValidatorSigner)

Trait Implementations§

source§

impl BorshDeserialize for BlockHeader

source§

fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>

source§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
source§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

source§

impl BorshSerialize for BlockHeader

source§

fn serialize<__W: Write>(&self, writer: &mut __W) -> Result<(), Error>

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 EnumExt for BlockHeader

source§

fn deserialize_variant<__R: Read>( reader: &mut __R, variant_tag: u8 ) -> Result<Self, Error>

Deserialises given variant of an enum from the reader. Read more
source§

impl From<BlockHeader> for BlockHeaderInnerLiteView

source§

fn from(header: BlockHeader) -> Self

Converts to this type from the input type.
source§

impl From<BlockHeader> for BlockHeaderView

source§

fn from(header: BlockHeader) -> Self

Converts to this type from the input type.
source§

impl From<BlockHeader> for LightClientBlockLiteView

source§

fn from(header: BlockHeader) -> Self

Converts to this type from the input type.
source§

impl From<BlockHeaderView> for BlockHeader

source§

fn from(view: BlockHeaderView) -> Self

Converts to this type from the input type.
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 Serialize for BlockHeader

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for BlockHeader

source§

impl StructuralPartialEq for BlockHeader

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where 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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where 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 T
where 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 T
where 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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more