ProvidesUnvalidatedScannableBlocks

Trait ProvidesUnvalidatedScannableBlocks 

Source
pub trait ProvidesUnvalidatedScannableBlocks: Sync {
    // Required method
    fn scannable_block(
        &self,
        hash: [u8; 32],
    ) -> impl Send + Future<Output = Result<UnvalidatedScannableBlock, InterfaceError>>;

    // Provided methods
    fn contiguous_scannable_blocks(
        &self,
        range: RangeInclusive<usize>,
    ) -> impl Send + Future<Output = Result<Vec<UnvalidatedScannableBlock>, InterfaceError>> { ... }
    fn scannable_block_by_number(
        &self,
        number: usize,
    ) -> impl Send + Future<Output = Result<UnvalidatedScannableBlock, InterfaceError>> { ... }
}
Expand description

Provides scannable blocks from an untrusted interface.

This provides some of its methods yet (contiguous_scannable_blocks || scannable_block_by_number) MUST be overriden, and the batch method SHOULD be overriden.

Required Methods§

Source

fn scannable_block( &self, hash: [u8; 32], ) -> impl Send + Future<Output = Result<UnvalidatedScannableBlock, InterfaceError>>

Get a ScannableBlock by its hash.

No validation is applied to the received block other than that it deserializes.

Provided Methods§

Source

fn contiguous_scannable_blocks( &self, range: RangeInclusive<usize>, ) -> impl Send + Future<Output = Result<Vec<UnvalidatedScannableBlock>, InterfaceError>>

Get a contiguous range of ScannableBlocks.

No validation is applied to the received blocks other than that they deserialize and have the expected amount of blocks returned.

Source

fn scannable_block_by_number( &self, number: usize, ) -> impl Send + Future<Output = Result<UnvalidatedScannableBlock, InterfaceError>>

Get a ScannableBlock by its number.

No validation is applied to the received block other than that it deserializes.

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§