Struct snarkvm_ledger_block::header::Metadata
source · pub struct Metadata<N: Network> { /* private fields */ }
Implementations§
source§impl<N: Network> Metadata<N>
impl<N: Network> Metadata<N>
sourcepub fn verify(
&self,
expected_round: u64,
expected_height: u32,
expected_cumulative_weight: u128,
expected_cumulative_proof_target: u128,
expected_coinbase_target: u64,
expected_proof_target: u64,
expected_last_coinbase_target: u64,
expected_last_coinbase_timestamp: i64,
expected_timestamp: i64,
current_timestamp: i64
) -> Result<()>
pub fn verify( &self, expected_round: u64, expected_height: u32, expected_cumulative_weight: u128, expected_cumulative_proof_target: u128, expected_coinbase_target: u64, expected_proof_target: u64, expected_last_coinbase_target: u64, expected_last_coinbase_timestamp: i64, expected_timestamp: i64, current_timestamp: i64 ) -> Result<()>
Ensures the block metadata is correct.
source§impl<N: Network> Metadata<N>
impl<N: Network> Metadata<N>
source§impl<N: Network> Metadata<N>
impl<N: Network> Metadata<N>
sourcepub const fn cumulative_weight(&self) -> u128
pub const fn cumulative_weight(&self) -> u128
Returns the cumulative weight for this block.
sourcepub const fn cumulative_proof_target(&self) -> u128
pub const fn cumulative_proof_target(&self) -> u128
Returns the cumulative proof target for this block.
sourcepub const fn coinbase_target(&self) -> u64
pub const fn coinbase_target(&self) -> u64
Returns the coinbase target for this block.
sourcepub const fn proof_target(&self) -> u64
pub const fn proof_target(&self) -> u64
Returns the proof target for this block.
sourcepub const fn last_coinbase_target(&self) -> u64
pub const fn last_coinbase_target(&self) -> u64
Returns the coinbase target of the last coinbase.
sourcepub const fn last_coinbase_timestamp(&self) -> i64
pub const fn last_coinbase_timestamp(&self) -> i64
Returns the block timestamp of the last coinbase.
Trait Implementations§
source§impl<'de, N: Network> Deserialize<'de> for Metadata<N>
impl<'de, N: Network> Deserialize<'de> for Metadata<N>
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the metadata from a JSON-string or buffer.
source§impl<N: PartialEq + Network> PartialEq for Metadata<N>
impl<N: PartialEq + Network> PartialEq for Metadata<N>
source§impl<N: Network> ToBits for Metadata<N>
impl<N: Network> ToBits for Metadata<N>
source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
Returns the little-endian bits of the metadata.
source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
Returns the big-endian bits of the metadata.
§fn to_bits_le(&self) -> Vec<bool>
fn to_bits_le(&self) -> Vec<bool>
Returns
self
as a boolean array in little-endian order.§fn to_bits_be(&self) -> Vec<bool>
fn to_bits_be(&self) -> Vec<bool>
Returns
self
as a boolean array in big-endian order.impl<N: Copy + Network> Copy for Metadata<N>
impl<N: Eq + Network> Eq for Metadata<N>
impl<N: Network> StructuralEq for Metadata<N>
impl<N: Network> StructuralPartialEq for Metadata<N>
Auto Trait Implementations§
impl<N> RefUnwindSafe for Metadata<N>where N: RefUnwindSafe,
impl<N> Send for Metadata<N>
impl<N> Sync for Metadata<N>
impl<N> Unpin for Metadata<N>where N: Unpin,
impl<N> UnwindSafe for Metadata<N>where N: UnwindSafe,
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
§impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere T: DeserializeOwned,
fn take_from_value<D>( value: &mut Value, field: &str ) -> Result<T, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.