some consensus stuff.
This commit is contained in:
parent
81d2e1b700
commit
53fb6dc8d5
@ -326,8 +326,8 @@ Block.prototype.__defineGetter__('commitmentHash', function() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Block.prototype._verify = function _verify(ret) {
|
Block.prototype._verify = function _verify(ret) {
|
||||||
var uniq = {};
|
var sigops = 0;
|
||||||
var i, tx, hash;
|
var i, tx, merkle;
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = {};
|
ret = {};
|
||||||
@ -361,18 +361,32 @@ Block.prototype._verify = function _verify(ret) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for duplicate txids
|
// Sanity checks
|
||||||
hash = tx.hash('hex');
|
if (!tx.isSane(ret))
|
||||||
if (uniq[hash]) {
|
|
||||||
ret.reason = 'bad-txns-duplicate';
|
|
||||||
ret.score = 100;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
uniq[hash] = true;
|
// Count legacy sigops (do not count scripthash or witness)
|
||||||
|
// sigops += tx._getSigops();
|
||||||
|
// if (sigops > constants.block.MAX_SIGOPS) {
|
||||||
|
// return callback(new VerifyError(block,
|
||||||
|
// 'invalid',
|
||||||
|
// 'bad-blk-sigops',
|
||||||
|
// 100));
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check merkle root
|
// Check merkle root
|
||||||
if (this.merkleRoot !== this.getMerkleRoot('hex')) {
|
merkle = this.getMerkleRoot('hex');
|
||||||
|
|
||||||
|
// If the merkle is mutated,
|
||||||
|
// we have duplicate txs.
|
||||||
|
if (!merkle) {
|
||||||
|
ret.reason = 'bad-txns-duplicate';
|
||||||
|
ret.score = 100;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.merkleRoot !== merkle) {
|
||||||
ret.reason = 'bad-txnmrkleroot';
|
ret.reason = 'bad-txnmrkleroot';
|
||||||
ret.score = 100;
|
ret.score = 100;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -822,7 +822,7 @@ Chain.prototype._checkInputs = function _checkInputs(block, prev, flags, callbac
|
|||||||
// Check for block sigops limits
|
// Check for block sigops limits
|
||||||
// Start counting P2SH sigops once block
|
// Start counting P2SH sigops once block
|
||||||
// timestamps reach March 31st, 2012.
|
// timestamps reach March 31st, 2012.
|
||||||
if (block.ts >= constants.block.BIP16_TIME)
|
if (flags & constants.flags.VERIFY_P2SH)
|
||||||
sigops += tx.getSigops(true);
|
sigops += tx.getSigops(true);
|
||||||
else
|
else
|
||||||
sigops += tx.getSigops();
|
sigops += tx.getSigops();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user