[][src]Trait sp_runtime::offchain::storage_lock::BlockNumberProvider

pub trait BlockNumberProvider {
    type BlockNumber: Codec + Clone + Ord + Eq + AtLeast32BitUnsigned;
    fn current_block_number() -> Self::BlockNumber;
}

Bound for a block number source used with BlockAndTime<BlockNumberProvider>.

Associated Types

type BlockNumber: Codec + Clone + Ord + Eq + AtLeast32BitUnsigned

Type of BlockNumber to provide.

Loading content...

Required methods

fn current_block_number() -> Self::BlockNumber

Returns the current block number.

Provides an abstraction over an arbitrary way of providing the current block number.

In case of using crate sp_runtime without the crate frame system, it is already implemented for frame_system::Module<T: Trait> as:

This example is not tested
fn current_block_number() -> Self {
    frame_system::Module<Trait>::block_number()
}

.

Loading content...

Implementors

Loading content...