pub struct Tip {
pub height: u64,
pub last_block_h: Hash,
pub prev_block_h: Hash,
pub total_difficulty: Difficulty,
}
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.
Height of the tip (max height of the fork)
Last block pushed to the fork
Total difficulty accumulated on that fork
Creates a new tip based on provided header.
Really easy to accidentally call hash() on a tip (thinking its a header).
So lets make hash() do the right thing here.
Returns the "default value" for a type. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Serialize this value into the given Serde serializer. Read more
Deserialize this value from the given Serde deserializer. Read more
Reads the data necessary to this Readable from the provided reader
Serialization of a tip, required to save to datastore.
Write the data held by this Writeable to the provided writer
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
impl<T> SafeBorrow for T where T: ?Sized, | |
Given ptr
, which was obtained from a prior call to Self::borrow()
, return a value with the same nominal lifetime which is guaranteed to survive mutations to Self
. Read more
impl<'a, T> DefaultFeatures for T where T: 'a + Send + Sync + Clone, | |
Clone this value, and then immediately put it into a Box
behind a trait object of this trait. Read more
impl<'a, T> NonSyncFeatures for T where T: 'a + Clone, | |
Clone this value, and then immediately put it into a Box
behind a trait object of this trait. Read more
impl<T> DebugAny for T where T: Any + Debug, | |
impl<T> CloneAny for T where T: Clone + Any, | |
impl<T> UnsafeAny for T where T: Any, | |
Obtain the hash of the object
Hash the object together with another writeable object
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)