pub trait DifficultyApi<Block: BlockT, Difficulty: Decode>: Core<Block> {
    // Provided methods
    fn difficulty(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash
    ) -> Result<Difficulty, ApiError> { ... }
    fn difficulty_with_context(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
        context: ExecutionContext
    ) -> Result<Difficulty, ApiError> { ... }
}
Expand description

API for those chains that put their difficulty adjustment algorithm directly onto runtime. Note that while putting difficulty adjustment algorithm to runtime is safe, putting the PoW algorithm on runtime is not.

Provided Methods§

source

fn difficulty( &self, __runtime_api_at_param__: <Block as BlockT>::Hash ) -> Result<Difficulty, ApiError>

Return the target difficulty of the next block.

source

fn difficulty_with_context( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, context: ExecutionContext ) -> Result<Difficulty, ApiError>

Return the target difficulty of the next block.

Trait Implementations§

source§

impl<Block: BlockT, Difficulty: Decode> RuntimeApiInfo for dyn DifficultyApi<Block, Difficulty>

source§

const ID: [u8; 8] = _

The identifier of the runtime api.
source§

const VERSION: u32 = 1u32

The version of the runtime api.

Implementors§