Struct jormungandr::blockchain::tip::TipUpdater
source · pub struct TipUpdater {
tip: Tip,
blockchain: Blockchain,
watch_mbox: Option<MessageBox<WatchMsg>>,
fragment_mbox: Option<MessageBox<TransactionMsg>>,
stats_counter: Metrics,
}
Expand description
Handles updates to the tip. Only one of this structs should be active at any given time.
Fields§
§tip: Tip
§blockchain: Blockchain
§watch_mbox: Option<MessageBox<WatchMsg>>
§fragment_mbox: Option<MessageBox<TransactionMsg>>
§stats_counter: Metrics
Implementations§
source§impl TipUpdater
impl TipUpdater
pub fn new( tip: Tip, blockchain: Blockchain, fragment_mbox: Option<MessageBox<TransactionMsg>>, watch_mbox: Option<MessageBox<WatchMsg>>, stats_counter: Metrics ) -> Self
pub async fn run(&mut self, input: MessageQueue<Arc<Ref>>)
async fn switch_tip_branch( &mut self, candidate: Arc<Ref>, tip_hash: HeaderHash ) -> Result<(), Error>
async fn update_current_branch_tip( &mut self, candidate: Arc<Ref>, block: &Block ) -> Result<(), Error>
sourcepub async fn process_new_ref(
&mut self,
candidate: Arc<Ref>
) -> Result<(), Error>
pub async fn process_new_ref( &mut self, candidate: Arc<Ref> ) -> Result<(), Error>
process a new candidate block on top of the blockchain, this function may:
- update the current tip if the candidate’s parent is the current tip;
If the current tip is not the one being updated we will then trigger chain selection after updating that other branch as it may be possible that this branch just became more interesting for the current consensus algorithm.
fn try_request_fragment_removal( &mut self, fragment_ids: Vec<FragmentId>, header: &Header ) -> Result<(), TrySendError<TransactionMsg>>
sourceasync fn reprocess_tip(
blockchain: Blockchain,
tip: Arc<Ref>,
mbox: MessageBox<Arc<Ref>>
) -> Result<(), Error>
async fn reprocess_tip( blockchain: Blockchain, tip: Arc<Ref>, mbox: MessageBox<Arc<Ref>> ) -> Result<(), Error>
this function will re-process the tip against the different branches. this is because a branch may have become more interesting with time moving forward and branches may have been dismissed
Trait Implementations§
source§impl Clone for TipUpdater
impl Clone for TipUpdater
source§fn clone(&self) -> TipUpdater
fn clone(&self) -> TipUpdater
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for TipUpdater
impl Send for TipUpdater
impl Sync for TipUpdater
impl Unpin for TipUpdater
impl !UnwindSafe for TipUpdater
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<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>
Wrap the input message
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>
Wrap the input message
T
in a tonic::Request