diff --git a/lib/blockchain/chain.js b/lib/blockchain/chain.js index 91e0e3a9..b57fde6a 100644 --- a/lib/blockchain/chain.js +++ b/lib/blockchain/chain.js @@ -600,7 +600,7 @@ Chain.prototype.verifyInputs = async function verifyInputs(block, prev, state) { // Ensure tx is not double spending an output. if (i > 0) { - if (!(await view.spendInputs(this.db, tx))) { + if (!await view.spendInputs(this.db, tx)) { assert(!historical, 'BUG: Spent inputs in historical data!'); throw new VerifyError(block, 'invalid', @@ -684,7 +684,7 @@ Chain.prototype.verifyInputs = async function verifyInputs(block, prev, state) { } // Verify all txs in parallel. - if (!(await co.every(jobs))) { + if (!await co.every(jobs)) { throw new VerifyError(block, 'invalid', 'mandatory-script-verify-flag-failed', @@ -1137,7 +1137,7 @@ Chain.prototype._replay = async function _replay(block, silent) { if (!entry) throw new Error('Block not found.'); - if (!(await entry.isMainChain())) + if (!await entry.isMainChain()) throw new Error('Cannot reset on alternate chain.'); if (entry.isGenesis()) { diff --git a/lib/blockchain/chaindb.js b/lib/blockchain/chaindb.js index f7253772..5fe9a178 100644 --- a/lib/blockchain/chaindb.js +++ b/lib/blockchain/chaindb.js @@ -1201,7 +1201,7 @@ ChainDB.prototype.scan = async function scan(start, filter, iter) { if (!entry) return; - if (!(await entry.isMainChain())) + if (!await entry.isMainChain()) throw new Error('Cannot rescan an alternate chain.'); let total = 0; @@ -1478,7 +1478,7 @@ ChainDB.prototype.reset = async function reset(block) { if (!entry) throw new Error('Block not found.'); - if (!(await entry.isMainChain())) + if (!await entry.isMainChain()) throw new Error('Cannot reset on alternate chain.'); if (this.options.prune) diff --git a/lib/coins/coinview.js b/lib/coins/coinview.js index ee929c54..83689625 100644 --- a/lib/coins/coinview.js +++ b/lib/coins/coinview.js @@ -432,7 +432,7 @@ CoinView.prototype.readInputs = async function readInputs(db, tx) { let found = true; for (const {prevout} of tx.inputs) { - if (!(await this.readCoin(db, prevout))) + if (!await this.readCoin(db, prevout)) found = false; } diff --git a/lib/http/server.js b/lib/http/server.js index 09c2bf1e..88d20394 100644 --- a/lib/http/server.js +++ b/lib/http/server.js @@ -446,7 +446,7 @@ HTTPServer.prototype.handleAuth = function handleAuth(socket) { if (!entry) return null; - if (!(await entry.isMainChain())) + if (!await entry.isMainChain()) return null; return entry.toRaw(); diff --git a/lib/mempool/mempool.js b/lib/mempool/mempool.js index 5f26260b..44dbeb06 100644 --- a/lib/mempool/mempool.js +++ b/lib/mempool/mempool.js @@ -782,7 +782,7 @@ Mempool.prototype.insertTX = async function insertTX(tx, id) { } // Verify transaction finality (see isFinal()). - if (!(await this.verifyFinal(tx, lockFlags))) { + if (!await this.verifyFinal(tx, lockFlags)) { throw new VerifyError(tx, 'nonstandard', 'non-final', @@ -864,7 +864,7 @@ Mempool.prototype.verify = async function verify(entry, view) { const tx = entry.tx; // Verify sequence locks. - if (!(await this.verifyLocks(tx, view, lockFlags))) { + if (!await this.verifyLocks(tx, view, lockFlags)) { throw new VerifyError(tx, 'nonstandard', 'non-BIP68-final', diff --git a/lib/net/pool.js b/lib/net/pool.js index 3db7ba69..f8c99870 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -1717,7 +1717,7 @@ Pool.prototype.handleBlockInv = async function handleBlockInv(peer, hashes) { } // Request the block if we don't have it. - if (!(await this.hasBlock(hash))) { + if (!await this.hasBlock(hash)) { items.push(hash); continue; } diff --git a/lib/wallet/nodeclient.js b/lib/wallet/nodeclient.js index 5df73938..17e3a721 100644 --- a/lib/wallet/nodeclient.js +++ b/lib/wallet/nodeclient.js @@ -108,7 +108,7 @@ NodeClient.prototype.getEntry = async function getEntry(hash) { if (!entry) return null; - if (!(await entry.isMainChain())) + if (!await entry.isMainChain()) return null; return entry; diff --git a/lib/wallet/rpc.js b/lib/wallet/rpc.js index 08eb99f2..2399bcfd 100644 --- a/lib/wallet/rpc.js +++ b/lib/wallet/rpc.js @@ -1512,7 +1512,7 @@ RPC.prototype.importPrunedFunds = async function importPrunedFunds(args, help) { height: height }; - if (!(await this.wdb.addTX(tx, entry))) + if (!await this.wdb.addTX(tx, entry)) throw new RPCError(errs.WALLET_ERROR, 'No tracked address for TX.'); return null; @@ -1529,7 +1529,7 @@ RPC.prototype.removePrunedFunds = async function removePrunedFunds(args, help) { if (!hash) throw new RPCError(errs.TYPE_ERROR, 'Invalid parameter.'); - if (!(await wallet.remove(hash))) + if (!await wallet.remove(hash)) throw new RPCError(errs.WALLET_ERROR, 'Transaction not in wallet.'); return null; diff --git a/migrate/chaindb2to3.js b/migrate/chaindb2to3.js index 98164e23..89899cfb 100644 --- a/migrate/chaindb2to3.js +++ b/migrate/chaindb2to3.js @@ -162,7 +162,7 @@ async function reserializeUndo(hash) { } if (!blockData) { - if (!(await isPruned())) + if (!await isPruned()) throw new Error(`Block not found: ${tip.hash}.`); break; } diff --git a/test/chain-test.js b/test/chain-test.js index 1f24b6d2..19d0a895 100644 --- a/test/chain-test.js +++ b/test/chain-test.js @@ -137,7 +137,7 @@ describe('Chain', function() { assert(tip1); assert(tip2); - assert(!(await tip2.isMainChain())); + assert(!await tip2.isMainChain()); } }); diff --git a/test/node-test.js b/test/node-test.js index 440e7f07..e5a37e2e 100644 --- a/test/node-test.js +++ b/test/node-test.js @@ -93,7 +93,7 @@ describe('Node', function() { assert(tip1); assert(tip2); - assert(!(await tip2.isMainChain())); + assert(!await tip2.isMainChain()); await co.wait(); }