Skip to main content

ReorgHandler

Trait ReorgHandler 

Source
pub trait ReorgHandler<N: Network> {
    // Required method
    async fn check(
        &mut self,
        block: &N::BlockResponse,
    ) -> Result<Option<N::BlockResponse>, ScannerError>;
}
Expand description

Trait for handling chain reorganizations.

Required Methods§

Source

async fn check( &mut self, block: &N::BlockResponse, ) -> Result<Option<N::BlockResponse>, ScannerError>

Checks if a block was reorged and returns the common ancestor if found.

§Arguments
  • block - The block to check for reorg.
§Returns
  • Ok(Some(common_ancestor)) - If a reorg was detected, returns the common ancestor block.
  • Ok(None) - If no reorg was detected, returns None.
  • Err(e) - If an error occurred while checking for reorg.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§