chain: shave a few ms of block processing time.

This commit is contained in:
Christopher Jeffrey 2017-02-13 22:27:23 -08:00
parent 1e07d1ba83
commit 275eb917aa
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -605,13 +605,15 @@ Chain.prototype.verifyInputs = co(function* verifyInputs(block, prev, state) {
}
// Verify sequence locks.
valid = yield this.verifyLocks(prev, tx, view, state.lockFlags);
if (i > 0 && tx.version >= 2) {
valid = yield this.verifyLocks(prev, tx, view, state.lockFlags);
if (!valid) {
throw new VerifyError(block,
'invalid',
'bad-txns-nonfinal',
100);
if (!valid) {
throw new VerifyError(block,
'invalid',
'bad-txns-nonfinal',
100);
}
}
// Count sigops (legacy + scripthash? + witness?)
@ -644,6 +646,14 @@ Chain.prototype.verifyInputs = co(function* verifyInputs(block, prev, state) {
if (historical)
return view;
// Make sure the miner isn't trying to conjure more coins.
if (block.getClaimed() > block.getReward(view, height, this.network)) {
throw new VerifyError(block,
'invalid',
'bad-cb-amount',
100);
}
// Verify all txs in parallel.
valid = yield co.every(jobs);
@ -654,14 +664,6 @@ Chain.prototype.verifyInputs = co(function* verifyInputs(block, prev, state) {
100);
}
// Make sure the miner isn't trying to conjure more coins.
if (block.getClaimed() > block.getReward(view, height, this.network)) {
throw new VerifyError(block,
'invalid',
'bad-cb-amount',
100);
}
return view;
});