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 sigops = 0;
|
||||
let reward = 0;
|
||||
let valid;
|
||||
|
||||
if (this.options.spv)
|
||||
return view;
|
||||
@ -615,15 +614,13 @@ Chain.prototype.verifyInputs = async function verifyInputs(block, prev, state) {
|
||||
'bad-cb-amount',
|
||||
100);
|
||||
}
|
||||
|
||||
// Push onto verification queue.
|
||||
jobs.push(tx.verifyAsync(view, state.flags, this.workers));
|
||||
}
|
||||
|
||||
// Add new coins.
|
||||
view.addTX(tx, height);
|
||||
}
|
||||
|
||||
// Skip script verification.
|
||||
if (historical)
|
||||
return view;
|
||||
|
||||
@ -637,10 +634,14 @@ Chain.prototype.verifyInputs = async function verifyInputs(block, prev, state) {
|
||||
100);
|
||||
}
|
||||
|
||||
// Verify all txs in parallel.
|
||||
valid = await co.every(jobs);
|
||||
// Push onto verification queue.
|
||||
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,
|
||||
'invalid',
|
||||
'mandatory-script-verify-flag-failed',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user