zebra_consensus

Function difficulty_is_valid

source
pub fn difficulty_is_valid(
    header: &Header,
    network: &Network,
    height: &Height,
    hash: &Hash,
) -> Result<(), BlockError>
Expand description

Returns Ok(()) if hash passes:

  • the target difficulty limit for network (PoWLimit), and
  • the difficulty filter,

based on the fields in header.

If the block is invalid, returns an error containing height and hash.