chain: post-verify transactions due to potential of rejected promises.
This commit is contained in:
parent
d7970882b3
commit
ff856fd6c2
@ -547,7 +547,6 @@ Chain.prototype.verifyInputs = async function verifyInputs(block, prev, state) {
|
|||||||
let jobs = [];
|
let jobs = [];
|
||||||
let sigops = 0;
|
let sigops = 0;
|
||||||
let reward = 0;
|
let reward = 0;
|
||||||
let valid;
|
|
||||||
|
|
||||||
if (this.options.spv)
|
if (this.options.spv)
|
||||||
return view;
|
return view;
|
||||||
@ -615,15 +614,13 @@ Chain.prototype.verifyInputs = async function verifyInputs(block, prev, state) {
|
|||||||
'bad-cb-amount',
|
'bad-cb-amount',
|
||||||
100);
|
100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push onto verification queue.
|
|
||||||
jobs.push(tx.verifyAsync(view, state.flags, this.workers));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add new coins.
|
// Add new coins.
|
||||||
view.addTX(tx, height);
|
view.addTX(tx, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip script verification.
|
||||||
if (historical)
|
if (historical)
|
||||||
return view;
|
return view;
|
||||||
|
|
||||||
@ -637,10 +634,14 @@ Chain.prototype.verifyInputs = async function verifyInputs(block, prev, state) {
|
|||||||
100);
|
100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify all txs in parallel.
|
// Push onto verification queue.
|
||||||
valid = await co.every(jobs);
|
for (let i = 1; i < block.txs.length; i++) {
|
||||||
|
let tx = block.txs[i];
|
||||||
|
jobs.push(tx.verifyAsync(view, state.flags, this.workers));
|
||||||
|
}
|
||||||
|
|
||||||
if (!valid) {
|
// Verify all txs in parallel.
|
||||||
|
if (!(await co.every(jobs))) {
|
||||||
throw new VerifyError(block,
|
throw new VerifyError(block,
|
||||||
'invalid',
|
'invalid',
|
||||||
'mandatory-script-verify-flag-failed',
|
'mandatory-script-verify-flag-failed',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user