pub enum BlockHeader {
BlockHeaderV1(Arc<BlockHeaderV1>),
BlockHeaderV2(Arc<BlockHeaderV2>),
BlockHeaderV3(Arc<BlockHeaderV3>),
BlockHeaderV4(Arc<BlockHeaderV4>),
BlockHeaderV5(Arc<BlockHeaderV5>),
}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>)
BlockHeaderV5(Arc<BlockHeaderV5>)
Implementations§
Source§impl BlockHeader
impl BlockHeader
pub fn compute_inner_hash(inner_lite: &[u8], inner_rest: &[u8]) -> CryptoHash
pub fn compute_hash( prev_hash: CryptoHash, inner_lite: &[u8], inner_rest: &[u8], ) -> CryptoHash
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: Utc, initial_gas_price: Balance, initial_total_supply: Balance, next_bp_hash: CryptoHash, ) -> Self
pub fn is_genesis(&self) -> bool
pub fn hash(&self) -> &CryptoHash
pub fn prev_hash(&self) -> &CryptoHash
pub fn signature(&self) -> &Signature
pub fn height(&self) -> BlockHeight
pub fn prev_height(&self) -> Option<BlockHeight>
pub fn epoch_id(&self) -> &EpochId
pub fn next_epoch_id(&self) -> &EpochId
pub fn prev_state_root(&self) -> &MerkleHash
pub fn prev_chunk_outgoing_receipts_root(&self) -> &MerkleHash
pub fn chunk_headers_root(&self) -> &MerkleHash
pub fn chunk_tx_root(&self) -> &MerkleHash
pub fn chunks_included(&self) -> u64
pub fn challenges_root(&self) -> &MerkleHash
pub fn outcome_root(&self) -> &MerkleHash
pub fn block_body_hash(&self) -> Option<CryptoHash>
pub fn raw_timestamp(&self) -> u64
pub fn prev_validator_proposals(&self) -> ValidatorStakeIter<'_> ⓘ
pub fn chunk_mask(&self) -> &[bool]
pub fn block_ordinal(&self) -> NumBlocks
pub fn next_gas_price(&self) -> Balance
pub fn total_supply(&self) -> Balance
pub fn random_value(&self) -> &CryptoHash
pub fn last_final_block(&self) -> &CryptoHash
pub fn last_ds_final_block(&self) -> &CryptoHash
pub fn challenges_result(&self) -> &ChallengesResult
pub fn next_bp_hash(&self) -> &CryptoHash
pub fn block_merkle_root(&self) -> &CryptoHash
pub fn epoch_sync_data_hash(&self) -> Option<CryptoHash>
pub fn approvals(&self) -> &[Option<Box<Signature>>]
Sourcepub fn verify_block_producer(&self, public_key: &PublicKey) -> bool
pub fn verify_block_producer(&self, public_key: &PublicKey) -> bool
Verifies that given public key produced the block.
pub fn timestamp(&self) -> Utc
pub fn num_approvals(&self) -> u64
pub fn verify_chunks_included(&self) -> bool
pub fn latest_protocol_version(&self) -> u32
pub fn inner_lite_bytes(&self) -> Vec<u8> ⓘ
pub fn inner_rest_bytes(&self) -> Vec<u8> ⓘ
pub fn chunk_endorsements(&self) -> Option<&ChunkEndorsementsBitmap>
pub fn inner_lite(&self) -> &BlockHeaderInnerLite
Source§impl BlockHeader
impl BlockHeader
pub fn set_latest_protocol_version( &mut self, latest_protocol_version: ProtocolVersion, )
pub fn resign(&mut self, signer: &ValidatorSigner)
pub fn init(&mut self)
pub fn set_prev_hash(&mut self, value: CryptoHash)
pub fn set_height(&mut self, value: BlockHeight)
pub fn set_epoch_id(&mut self, value: EpochId)
pub fn set_prev_state_root(&mut self, value: MerkleHash)
pub fn set_prev_chunk_outgoing_receipts_root(&mut self, value: MerkleHash)
pub fn set_chunk_headers_root(&mut self, value: MerkleHash)
pub fn set_chunk_tx_root(&mut self, value: MerkleHash)
pub fn set_chunk_mask(&mut self, value: Vec<bool>)
pub fn set_chunk_endorsements(&mut self, value: ChunkEndorsementsBitmap)
pub fn set_prev_outcome_root(&mut self, value: MerkleHash)
pub fn set_timestamp(&mut self, value: u64)
pub fn set_prev_validator_proposals(&mut self, value: Vec<ValidatorStake>)
pub fn set_next_gas_price(&mut self, value: Balance)
pub fn set_block_merkle_root(&mut self, value: CryptoHash)
pub fn set_approvals(&mut self, value: Vec<Option<Box<Signature>>>)
pub fn set_block_body_hash(&mut self, value: CryptoHash)
pub fn set_signature(&mut self, value: Signature)
pub fn set_challenges_root(&mut self, value: MerkleHash)
Trait Implementations§
Source§impl BorshDeserialize for BlockHeader
impl BorshDeserialize for BlockHeader
fn deserialize_reader<__R: Read>(reader: &mut __R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
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>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
Deserialize this instance from a slice of bytes.
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for BlockHeader
impl BorshSerialize for BlockHeader
Source§impl Clone for BlockHeader
impl Clone for BlockHeader
Source§fn clone(&self) -> BlockHeader
fn clone(&self) -> BlockHeader
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BlockHeader
impl Debug for BlockHeader
Source§impl EnumExt for BlockHeader
impl EnumExt for BlockHeader
Source§impl From<BlockHeader> for BlockHeaderInnerLiteView
impl From<BlockHeader> for BlockHeaderInnerLiteView
Source§fn from(header: BlockHeader) -> Self
fn from(header: BlockHeader) -> Self
Converts to this type from the input type.
Source§impl From<BlockHeader> for BlockHeaderView
impl From<BlockHeader> for BlockHeaderView
Source§fn from(header: BlockHeader) -> Self
fn from(header: BlockHeader) -> Self
Converts to this type from the input type.
Source§impl From<BlockHeader> for LightClientBlockLiteView
impl From<BlockHeader> for LightClientBlockLiteView
Source§fn from(header: BlockHeader) -> Self
fn from(header: BlockHeader) -> Self
Converts to this type from the input type.
Source§impl From<BlockHeaderView> for BlockHeader
impl From<BlockHeaderView> for BlockHeader
Source§fn from(view: BlockHeaderView) -> Self
fn from(view: BlockHeaderView) -> Self
Converts to this type from the input type.
Source§impl PartialEq for BlockHeader
impl PartialEq for BlockHeader
Source§impl Serialize for BlockHeader
impl Serialize for BlockHeader
impl Eq for BlockHeader
impl StructuralPartialEq for BlockHeader
Auto Trait Implementations§
impl Freeze for BlockHeader
impl RefUnwindSafe for BlockHeader
impl Send for BlockHeader
impl Sync for BlockHeader
impl Unpin for BlockHeader
impl UnwindSafe for BlockHeader
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.