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§
Sourceasync fn check(
&mut self,
block: &N::BlockResponse,
) -> Result<Option<N::BlockResponse>, ScannerError>
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, returnsNone.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.