code: function verifyHeader (currentHash, currentHeader, hashPrevBlock, prevHeader, target, isTestnet) {
    try {
      // check hashPrevBlock
      assert.equal(hashPrevBlock, currentHeader.hashPrevBlock)
  
      try {
        // check difficulty
        assert.equal(currentHeader.bits, target.bits)
        // check hash and target
        assert.equal(isGoodHash(currentHash, target.target), true)
  
      } catch (err) {
        // special case for testnet:
        // If no block has been found in 20 minutes, the difficulty automatically
        //  resets back to the minimum for a single block, after which it returns
        //  to its previous value.
        if (!(err instanceof assert.AssertionError &&
              isTestnet &&
              currentHeader.time - prevHeader.time > 1200)) {
          throw err
        }
  
        assert.equal(currentHeader.bits, MAX_BITS)
        assert.equal(isGoodHash(currentHash, MAX_TARGET), true)
      }
    } catch (err) {
      if (err instanceof assert.AssertionError) {
        throw new errors.Blockchain.VerifyHeaderError(currentHash, 'verification failed')
      }
  
      throw err
    }
  }
docs: Verify current header
  
  @param {string} currentHash
  @param {BitcoinHeader} currentHeader
  @param {string} hashPrevBlock
  @param {BitcoinHeader} prevHeader
  @param {{bits: number, target: string}} target
  @param {Boolean} isTestnet
  @throws {VerifyHeaderError}