fn verify_header_difficulty(&self, difficulty: U256, header: &BlockHeader) -> Result<()> {
        if header.difficulty() != difficulty {
            return Err(anyhow!(
                "Difficulty mismatch: {:?}, header: {:?}",
                difficulty,
                header
            ));
        }
        let nonce = header.nonce;
        let pow_header_blob = header.as_pow_header_blob();
        let pow_hash: U256 = self.calculate_pow_hash(&pow_header_blob, nonce)?.into();
        let target = difficult_to_target(difficulty);
        if pow_hash > target {
            anyhow::bail!("Invalid header:{:?}", header);
        }
        Ok(())
    }
/// Inner helper for verify and unit testing
Inner helper for verify and unit testing
Inner helper for verify and unit testing
fn verify_header_difficulty(&self, difficulty: U256, header: &BlockHeader) -> Result<()> {
        if header.difficulty() != difficulty {
            return Err(anyhow!(
                "Difficulty mismatch: {:?}, header: {:?}",
                difficulty,
                header
            ));
        }
        let nonce = header.nonce;
        let pow_header_blob = header.as_pow_header_blob();
        let pow_hash: U256 = self.calculate_pow_hash(&pow_header_blob, nonce)?.into();
        let target = difficult_to_target(difficulty);
        if pow_hash > target {
            anyhow::bail!("Invalid header:{:?}", header);
        }
        Ok(())
    }
fn verify_header_difficulty ( & self , difficulty : U256 , header : & BlockHeader ) -> Result < ( ) > { if header . difficulty ( ) != difficulty { return Err ( anyhow ! ( " " difficulty header ) ) ; } let nonce = header . nonce ; let pow_header_blob = header . as_pow_header_blob ( ) ; let pow_hash : U256 = self . calculate_pow_hash ( & pow_header_blob , nonce ) ? . into ( ) ; let target = difficult_to_target ( difficulty ) ; if pow_hash > target { anyhow :: bail ! ( " " header ) ; } Ok ( ( ) ) }
Inner helper for verify and unit testing
Inner helper for verify and unit testing
&self
difficulty
U256
header
&BlockHeader
&self
difficulty
U256
header
&BlockHeader