Struct jormungandr::blockchain::Ref
source · pub struct Ref {
ledger: Ref<Ledger>,
time_frame: Arc<TimeFrame>,
epoch_leadership_schedule: Arc<Leadership>,
epoch_rewards_info: Option<Arc<EpochRewardsInfo>>,
header: Header,
previous_epoch_state: Option<Arc<Ref>>,
}
Expand description
a reference to a block in the blockchain
Fields§
§ledger: Ref<Ledger>
Reference holder for the object in the Multiverse<Ledger>
.
time_frame: Arc<TimeFrame>
the time frame applicable in the current branch of the blockchain
epoch_leadership_schedule: Arc<Leadership>
the leadership used to validate the current header’s leader
this object will be shared between different Ref of the same epoch
epoch_rewards_info: Option<Arc<EpochRewardsInfo>>
If present, this is the rewards info distributed at the beginning of the epoch. Useful to follow up on the reward distribution history
header: Header
keep the Block header in memory, this will avoid retrieving the data from the storage if needs be
previous_epoch_state: Option<Arc<Ref>>
holder to the previous epoch state or more precisely the previous epoch’s
last Ref
. Every time there is a transition this value will be filled with
the parent Ref
. Otherwise it will be copied from Ref
to Ref
.
Implementations§
source§impl Ref
impl Ref
sourcepub fn new(
ledger: Ref<Ledger>,
time_frame: Arc<TimeFrame>,
epoch_leadership_schedule: Arc<Leadership>,
epoch_rewards_info: Option<Arc<EpochRewardsInfo>>,
header: Header,
previous_epoch_state: Option<Arc<Ref>>
) -> Self
pub fn new( ledger: Ref<Ledger>, time_frame: Arc<TimeFrame>, epoch_leadership_schedule: Arc<Leadership>, epoch_rewards_info: Option<Arc<EpochRewardsInfo>>, header: Header, previous_epoch_state: Option<Arc<Ref>> ) -> Self
create a new Ref
sourcepub fn hash(&self) -> HeaderHash
pub fn hash(&self) -> HeaderHash
retrieve the header hash of the Ref
sourcepub fn block_parent_hash(&self) -> HeaderHash
pub fn block_parent_hash(&self) -> HeaderHash
access the reference’s parent hash
sourcepub fn block_date(&self) -> BlockDate
pub fn block_date(&self) -> BlockDate
retrieve the block date of the Ref
sourcepub fn chain_length(&self) -> ChainLength
pub fn chain_length(&self) -> ChainLength
retrieve the chain length, the number of blocks created between the block0 and this block. This is useful to compare the density of 2 branches.
pub fn ledger(&self) -> Arc<Ledger>
sourcepub fn time_frame(&self) -> &Arc<TimeFrame>
pub fn time_frame(&self) -> &Arc<TimeFrame>
get the time frame in application in the current branch of the blockchain
pub fn epoch_leadership_schedule(&self) -> &Arc<Leadership>
sourcepub fn epoch_rewards_info(&self) -> Option<&Arc<EpochRewardsInfo>>
pub fn epoch_rewards_info(&self) -> Option<&Arc<EpochRewardsInfo>>
access the rewards info that were distributed at the end of the previous epoch (and that are accessible/visible from this epoch only).
pub fn last_ref_previous_epoch(&self) -> Option<&Arc<Ref>>
sourcepub fn slot(&self) -> Slot
pub fn slot(&self) -> Slot
get the chain_time’s Slot
. This allows to compute an accurate
block time via a given time_frame or a precise block time
sourcepub fn time(&self) -> SystemTime
pub fn time(&self) -> SystemTime
retrieve the time of the associated block.
sourcepub fn elapsed(&self) -> Result<Duration, SystemTimeError>
pub fn elapsed(&self) -> Result<Duration, SystemTimeError>
retrieve the time of the slot of the block. If the block is set in the future, this function will return an error.
sourcepub fn active_vote_plans(&self) -> Vec<VotePlanStatus>
pub fn active_vote_plans(&self) -> Vec<VotePlanStatus>
clone all active vote plans at this given state
this includes, votes to be voted on, on going votes, votes to be resolved and votes to result into a change on the ledger
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Ref
impl Send for Ref
impl Sync for Ref
impl Unpin for Ref
impl UnwindSafe for Ref
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request