pub struct AnchorBlockStore { /* private fields */ }Expand description
Stores the current anchor (synced) block header.
The anchor block header determines which state the PXE considers current. It is updated by the BlockStateSynchronizer and read during transaction simulation and event retrieval.
Implementations§
Source§impl AnchorBlockStore
impl AnchorBlockStore
pub fn new(kv: Arc<dyn KvStore>) -> Self
Sourcepub async fn set_header(&self, header: &AnchorBlockHeader) -> Result<(), Error>
pub async fn set_header(&self, header: &AnchorBlockHeader) -> Result<(), Error>
Set the anchor block header.
Sourcepub async fn get_block_header(&self) -> Result<Option<AnchorBlockHeader>, Error>
pub async fn get_block_header(&self) -> Result<Option<AnchorBlockHeader>, Error>
Get the anchor block header.
Returns None if no header has been set yet.
Sourcepub async fn get_block_header_or_err(&self) -> Result<AnchorBlockHeader, Error>
pub async fn get_block_header_or_err(&self) -> Result<AnchorBlockHeader, Error>
Get the anchor block header, returning an error if not set.
Sourcepub async fn get_block_number(&self) -> Result<u64, Error>
pub async fn get_block_number(&self) -> Result<u64, Error>
Get the current anchor block number, or 0 if not set.
Auto Trait Implementations§
impl Freeze for AnchorBlockStore
impl !RefUnwindSafe for AnchorBlockStore
impl Send for AnchorBlockStore
impl Sync for AnchorBlockStore
impl Unpin for AnchorBlockStore
impl !UnwindSafe for AnchorBlockStore
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more