Trait sp_consensus_pow::DifficultyApi
source · pub trait DifficultyApi<Block: BlockT, Difficulty: Decode>: Core<Block> {
fn difficulty(
&self,
__runtime_api_at_param__: &BlockId<Block>
) -> Result<Difficulty, ApiError> { ... }
fn difficulty_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
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§
sourcefn difficulty(
&self,
__runtime_api_at_param__: &BlockId<Block>
) -> Result<Difficulty, ApiError>
fn difficulty(
&self,
__runtime_api_at_param__: &BlockId<Block>
) -> Result<Difficulty, ApiError>
Return the target difficulty of the next block.
sourcefn difficulty_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext
) -> Result<Difficulty, ApiError>
fn difficulty_with_context(
&self,
__runtime_api_at_param__: &BlockId<Block>,
context: ExecutionContext
) -> Result<Difficulty, ApiError>
Return the target difficulty of the next block.