Struct solana_ledger::entry::Entry [−][src]
Each Entry contains three pieces of data. The num_hashes
field is the number
of hashes performed since the previous entry. The hash
field is the result
of hashing hash
from the previous entry num_hashes
times. The transactions
field points to Transactions that took place shortly before hash
was generated.
If you divide num_hashes
by the amount of time it takes to generate a new hash, you
get a duration estimate since the last Entry. Since processing power increases
over time, one should expect the duration num_hashes
represents to decrease proportionally.
An upper bound on Duration can be estimated by assuming each hash was generated by the
world’s fastest processor at the time the entry was recorded. Or said another way, it
is physically not possible for a shorter duration to have occurred if one assumes the
hash was computed by the world’s fastest processor at that time. The hash chain is both
a Verifiable Delay Function (VDF) and a Proof of Work (not to be confused with Proof of
Work consensus!)
Fields
num_hashes: u64
The number of hashes since the previous Entry ID.
hash: Hash
The SHA-256 hash num_hashes
after the previous Entry ID.
transactions: Vec<Transaction>
An unordered list of transactions that were observed before the Entry ID was generated. They may have been observed before a previous Entry ID but were pushed back into this list to ensure deterministic interpretation of the ledger.
Implementations
impl Entry
[src]
pub fn new(
prev_hash: &Hash,
num_hashes: u64,
transactions: Vec<Transaction>
) -> Self
[src]
prev_hash: &Hash,
num_hashes: u64,
transactions: Vec<Transaction>
) -> Self
Creates the next Entry num_hashes
after start_hash
.
pub fn new_mut(
start_hash: &mut Hash,
num_hashes: &mut u64,
transactions: Vec<Transaction>
) -> Self
[src]
start_hash: &mut Hash,
num_hashes: &mut u64,
transactions: Vec<Transaction>
) -> Self
pub fn verify(&self, start_hash: &Hash) -> bool
[src]
Verifies self.hash is the result of hashing a start_hash
self.num_hashes
times.
If the transaction is not a Tick, then hash that as well.
pub fn is_tick(&self) -> bool
[src]
Trait Implementations
impl Clone for Entry
[src]
impl Debug for Entry
[src]
impl Default for Entry
[src]
impl<'de> Deserialize<'de> for Entry
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for Entry
[src]
impl PartialEq<Entry> for Entry
[src]
impl Serialize for Entry
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for Entry
[src]
impl StructuralPartialEq for Entry
[src]
Auto Trait Implementations
impl RefUnwindSafe for Entry
impl Send for Entry
impl Sync for Entry
impl Unpin for Entry
impl UnwindSafe for Entry
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoRequest<T> for T
[src]
pub fn into_request(self) -> Request<T>
[src]
impl<T> MaybeDebug for T where
T: Debug,
[src]
T: Debug,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Typeable for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,