pub trait CompareStrategy<Block: BlockT, BlockInfo: Client<Block>> {
type Error: Error;
// Required method
fn compare_block(
&self,
block: NumberFor<Block>,
block_info: &BlockInfo,
) -> Result<Ordering, Self::Error>;
}
Expand description
Comparator used for binary searching the block history
Types implementing this trait represent some search target, which is to be found through binary search over block history. Note that this search target can be a single block defined by its slot or some other monotonically increasing block property, or a range of blocks defined by a range of slots or other property.
Required Associated Types§
Required Methods§
Sourcefn compare_block(
&self,
block: NumberFor<Block>,
block_info: &BlockInfo,
) -> Result<Ordering, Self::Error>
fn compare_block( &self, block: NumberFor<Block>, block_info: &BlockInfo, ) -> Result<Ordering, Self::Error>
Compares a block against a search target.
§Returns
Ok(Ordering::Less)
if the block is below the targetOk(Ordering::Equal)
if the block is at targetOk(Ordering::Greater)
if the block is above the targetErr
if an error occured