code: func checkProofOfWork(header *wire.BlockHeader, powLimit *big.Int, flags BehaviorFlags) error {
  	// The target difficulty must be larger than zero.
  	target := CompactToBig(header.Bits)
  	if target.Sign() <= 0 {
  		str := fmt.Sprintf("block target difficulty of %064x is too low",
  			target)
  		return ruleError(ErrUnexpectedDifficulty, str)
  	}
  
  	// The target difficulty must be less than the maximum allowed.
  	if target.Cmp(powLimit) > 0 {
  		str := fmt.Sprintf("block target difficulty of %064x is "+
  			"higher than max of %064x", target, powLimit)
  		return ruleError(ErrUnexpectedDifficulty, str)
  	}
  
  	// The block hash must be less than the claimed target unless the flag
  	// to avoid proof of work checks is set.
  	if flags&BFNoPoWCheck != BFNoPoWCheck {
  		// The block hash must be less than the claimed target.
  		hash := header.BlockHash()
  		hashNum := HashToBig(&hash)
  		if hashNum.Cmp(target) > 0 {
  			str := fmt.Sprintf("block hash of %064x is higher than "+
  				"expected max of %064x", hashNum, target)
  			return ruleError(ErrHighHash, str)
  		}
  	}
  
  	return nil
  }
docs: // checkProofOfWork ensures the block header bits which indicate the target
  // difficulty is in min/max range and that the block hash is less than the
  // target difficulty as claimed.
  //
  // The flags modify the behavior of this function as follows:
  //  - BFNoPoWCheck: The check to ensure the block hash is less than the target
  //    difficulty is not performed.