diff --git a/lib/mempool/mempool.js b/lib/mempool/mempool.js index 44dbeb06..4f91c4bf 100644 --- a/lib/mempool/mempool.js +++ b/lib/mempool/mempool.js @@ -961,21 +961,17 @@ Mempool.prototype.verify = async function verify(entry, view) { flags &= ~Script.flags.VERIFY_WITNESS; flags &= ~Script.flags.VERIFY_CLEANSTACK; - const valid1 = await this.verifyResult(tx, view, flags); - // If it failed, the first verification // was the only result we needed. - if (!valid1) + if (!await this.verifyResult(tx, view, flags)) throw err; // If it succeeded, segwit may be causing the // failure. Try with segwit but without cleanstack. flags |= Script.flags.VERIFY_CLEANSTACK; - const valid2 = await this.verifyResult(tx, view, flags); - // Cleanstack was causing the failure. - if (valid2) + if (await this.verifyResult(tx, view, flags)) throw err; // Do not insert into reject cache. @@ -986,8 +982,8 @@ Mempool.prototype.verify = async function verify(entry, view) { // Paranoid checks. if (this.options.paranoidChecks) { const flags = Script.flags.MANDATORY_VERIFY_FLAGS; - const valid = await this.verifyResult(tx, view, flags); - assert(valid, 'BUG: Verify failed for mandatory but not standard.'); + assert(await this.verifyResult(tx, view, flags), + 'BUG: Verify failed for mandatory but not standard.'); } };