This commit is contained in:
Christopher Jeffrey 2016-05-07 03:21:03 -07:00
parent b85a98b4ca
commit d1aaaefda1
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -471,16 +471,23 @@ Chain.prototype._verify = function _verify(block, prev, callback) {
if (!block.verify(ret))
return callback(new VerifyError(block, 'invalid', ret.reason, ret.score));
if (this.options.spv || block.type !== 'block')
return callback(null, constants.flags.MANDATORY_VERIFY_FLAGS);
// Skip the genesis block
if (block.isGenesis())
return callback(null, constants.flags.MANDATORY_VERIFY_FLAGS);
// Skip the genesis block. Skip all blocks in spv mode.
if (this.options.spv || block.isGenesis()) {
return callback(null, {
flags: constants.flags.MANDATORY_VERIFY_FLAGS,
lockFlags: constants.flags.MANDATORY_LOCKTIME_FLAGS,
segwit: false,
csv: false
});
}
// Ensure it's not an orphan
if (!prev)
return callback(new VerifyError(block, 'invalid', 'bad-prevblk', 0));
if (!prev) {
return callback(new VerifyError(block,
'invalid',
'bad-prevblk',
0));
}
prev.getRetargetAncestors(function(err, ancestors) {
if (err)
@ -513,7 +520,7 @@ Chain.prototype._verify = function _verify(block, prev, callback) {
self.segwitActive = state.segwit;
// Can't verify any further when merkleblock or headers.
if (block.type !== 'block')
if (this.options.spv)
return callback(null, state.flags);
// Make sure the height contained in the coinbase is correct.
@ -718,7 +725,7 @@ Chain.prototype._checkDuplicates = function _checkDuplicates(block, prev, callba
var self = this;
var height = prev.height + 1;
if (this.options.spv || block.type !== 'block')
if (this.options.spv)
return callback();
if (block.isGenesis())
@ -804,7 +811,7 @@ Chain.prototype._checkInputs = function _checkInputs(block, prev, state, callbac
var scriptCheck = true;
var historical = false;
if (this.options.spv || block.type !== 'block')
if (this.options.spv)
return callback();
if (block.isGenesis())