b0VIM 7.4۩Uz(nulldomus~null/code/ethereumjs-block/header.jsutf-8 U3210#"! Utp#adBbR$ vTM7'  n g N > "   x q [ ? 8 #  x \ U @ #  W # V !  ~:J.,+')p]YX>.*) `_:zBA if (!(dif.cmpn(8) === -1 && dif.cmpn(1) === 1)) { var dif = height.sub(new BN(parentBlock.header.number)) if (height) { } return cb('invalid number') if (number.cmp(new BN(parentBlock.header.number).addn(1)) !== 0) { var number = new BN(self.number) self.parentBlock = parentBlock } return cb('could not find parent block') if (err) { blockchain.getBlock(self.parentHash, function (err, parentBlock) { // find the blocks parent } return cb() if (this.isGenesis()) { } height = false cb = height if (arguments.length === 2) { var self = thisBlockHeader.prototype.validate = function (blockchain, height, cb) { */ * @param {Function} cb the callback function * @param {Bignum} [height] if this is an uncle header, this is the height of the block that is including it * @param {Blockchain} blockChain the blockchain that this block is validating against * @method validate * Validates the entire block headers/**} return maxGasLimit > gasLimit && minGasLimit < gasLimit && params.minGasLimit.v < gasLimit const minGasLimit = pGasLimit - a const maxGasLimit = pGasLimit + a const a = Math.floor(pGasLimit / params.gasLimitBoundDivisor.v) const gasLimit = utils.bufferToInt(this.gasLimit) const pGasLimit = utils.bufferToInt(parentBlock.header.gasLimit)BlockHeader.prototype.validateGasLimit = function (parentBlock) {} return dif === utils.bufferToInt(this.difficulty) const dif = this.canonicalDifficulty(parentBlock)BlockHeader.prototype.validateDifficulty = function (parentBlock) {// check the block for the canical difficulty} return dif } dif = Math.max(params.minimumDifficulty.v, parentDif - dif) } else { dif += parentDif if (blockTs < parentTs + params.durationLimit.v) { var dif = Math.floor(parentDif / params.difficultyBoundDivisor.v) const parentDif = utils.bufferToInt(parentBlock.header.difficulty) const parentTs = utils.bufferToInt(parentBlock.header.timestamp) const blockTs = utils.bufferToInt(this.timestamp)BlockHeader.prototype.canonicalDifficulty = function (parentBlock) {} utils.defineProperties(this, fields, data) }] default: new Buffer([]) // sha3(42) name: 'nonce', }, { // length: 32 default: utils.zeros(32) name: 'mixHash', }, { default: new Buffer([]) empty: true, allowZero: true, name: 'extraData', }, { default: new Buffer([]) name: 'timestamp', }, { default: new Buffer([]) empty: true, name: 'gasUsed', }, { default: new Buffer([]) name: 'gasLimit', }, { default: new Buffer([]) name: 'number', }, { default: new Buffer([]) name: 'difficulty', }, { default: utils.zeros(256) name: 'bloom', }, { default: utils.SHA3_RLP length: 32, name: 'receiptTrie', }, { default: utils.SHA3_RLP length: 32, name: 'transactionsTrie', }, { default: utils.zeros(32) length: 32, name: 'stateRoot', }, { default: utils.zeros(20) length: 20, name: 'coinbase', }, { default: utils.SHA3_RLP_ARRAY name: 'uncleHash', }, { default: utils.zeros(32) length: 32, name: 'parentHash', var fields = [{var BlockHeader = module.exports = function (data) { */ * @param {Array} data raw data, deserialized * @constructor * Represents a Block Header/**const rlp = utils.rlpconst BN = utils.BNconst params = require('ethereum-common')const utils = require('ethereumjs-util')ad #vPJImgf i c b Y T R Q & } return this.number.toString('hex') === ''BlockHeader.prototype.isGenesis = function () {} return utils.sha3(rlp.encode(this.raw))BlockHeader.prototype.hash = function () {} }) cb() } return cb('invalid amount of extra data') if (self.extraData.length > params.maximumExtraDataSize.v) { } return cb('invalid timestamp') if (utils.bufferToInt(self.timestamp) <= utils.bufferToInt(parentBlock.header.timestamp)) { } return cb('invalid heigth') if (utils.bufferToInt(parentBlock.header.number) + 1 !== utils.bufferToInt(self.number)) { } return cb('invalid gas limit') if (!self.validateGasLimit(parentBlock)) { } return cb('invalid Difficulty') if (!self.validateDifficulty(parentBlock)) { } } return cb('uncle block has a parent that is too old or to young')