Struct grin_chain::types::Tip
source · pub struct Tip {
pub height: u64,
pub last_block_h: Hash,
pub prev_block_h: Hash,
pub total_difficulty: Difficulty,
}
Expand description
The tip of a fork. A handle to the fork ancestry from its leaf in the blockchain tree. References the max height and the latest and previous blocks for convenience and the total difficulty.
Fields§
§height: u64
Height of the tip (max height of the fork)
last_block_h: Hash
Last block pushed to the fork
prev_block_h: Hash
Previous block
total_difficulty: Difficulty
Total difficulty accumulated on that fork
Implementations§
source§impl Tip
impl Tip
sourcepub fn from_header(header: &BlockHeader) -> Tip
pub fn from_header(header: &BlockHeader) -> Tip
Creates a new tip based on provided header.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Tip
impl<'de> Deserialize<'de> for Tip
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 From<&BlockHeader> for Tip
impl From<&BlockHeader> for Tip
source§fn from(header: &BlockHeader) -> Self
fn from(header: &BlockHeader) -> Self
Converts to this type from the input type.
source§impl From<BlockHeader> for Tip
impl From<BlockHeader> for Tip
source§fn from(header: BlockHeader) -> Self
fn from(header: BlockHeader) -> Self
Converts to this type from the input type.
impl Copy for Tip
impl StructuralPartialEq for Tip
Auto Trait Implementations§
impl Freeze for Tip
impl RefUnwindSafe for Tip
impl Send for Tip
impl Sync for Tip
impl Unpin for Tip
impl UnwindSafe for Tip
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<'a, T> DefaultFeatures<'a> for T
impl<'a, T> DefaultFeatures<'a> for T
source§fn clone_boxed(&self) -> Box<dyn DefaultFeatures<'a>>
fn clone_boxed(&self) -> Box<dyn DefaultFeatures<'a>>
Clone this value, and then immediately put it into a
Box
behind a trait object of this trait.source§impl<'a, T> NonSyncFeatures<'a> for Twhere
T: 'a + Clone,
impl<'a, T> NonSyncFeatures<'a> for Twhere
T: 'a + Clone,
source§fn clone_boxed(&self) -> Box<dyn NonSyncFeatures<'a>>
fn clone_boxed(&self) -> Box<dyn NonSyncFeatures<'a>>
Clone this value, and then immediately put it into a
Box
behind a trait object of this trait.source§impl<T> SafeBorrow<T> for Twhere
T: ?Sized,
impl<T> SafeBorrow<T> for Twhere
T: ?Sized,
source§impl<H> ShortIdentifiable for Hwhere
H: Hashed,
impl<H> ShortIdentifiable for Hwhere
H: Hashed,
source§fn short_id(&self, hash: &Hash, nonce: u64) -> ShortId
fn short_id(&self, hash: &Hash, nonce: u64) -> ShortId
Generate a short_id via the following -
- extract k0/k1 from block_hash hashed with the nonce (first two u64
values) * initialize a siphasher24 with k0/k1
- self.hash() passing in the siphasher24 instance
- drop the 2 most significant bytes (to return a 6 byte short_id)