diff --git a/lib/http/rpc.js b/lib/http/rpc.js index 9ae5db0f..5a1c95b3 100644 --- a/lib/http/rpc.js +++ b/lib/http/rpc.js @@ -1460,7 +1460,6 @@ RPC.prototype.getMiningInfo = async function getMiningInfo(args, help) { let weight = 0; let txs = 0; let diff = 0; - let item; if (help || args.length !== 0) throw new RPCError(errs.MISC_ERROR, 'getmininginfo'); @@ -1470,7 +1469,7 @@ RPC.prototype.getMiningInfo = async function getMiningInfo(args, help) { txs = attempt.items.length + 1; diff = attempt.getDifficulty(); size = 1000; - for (item of attempt.items) + for (let item of attempt.items) size += item.tx.getBaseSize(); } diff --git a/lib/mempool/fees.js b/lib/mempool/fees.js index ab576961..379e979d 100644 --- a/lib/mempool/fees.js +++ b/lib/mempool/fees.js @@ -625,8 +625,6 @@ PolicyEstimator.prototype.processBlockTX = function processBlockTX(height, entry */ PolicyEstimator.prototype.processBlock = function processBlock(height, entries, current) { - let entry; - // Ignore reorgs. if (height <= this.bestHeight) return; @@ -673,7 +671,7 @@ PolicyEstimator.prototype.processBlock = function processBlock(height, entries, this.feeStats.clearCurrent(height); this.priStats.clearCurrent(height); - for (entry of entries) + for (let entry of entries) this.processBlockTX(height, entry); this.feeStats.updateAverages(); diff --git a/lib/script/witness.js b/lib/script/witness.js index aaa45643..263a90eb 100644 --- a/lib/script/witness.js +++ b/lib/script/witness.js @@ -357,11 +357,9 @@ Witness.prototype.getVarSize = function getVarSize() { */ Witness.prototype.toWriter = function toWriter(bw) { - let item; - bw.writeVarint(this.items.length); - for (item of this.items) + for (let item of this.items) bw.writeVarBytes(item); return bw; diff --git a/lib/wallet/account.js b/lib/wallet/account.js index 013aad34..66ca8e78 100644 --- a/lib/wallet/account.js +++ b/lib/wallet/account.js @@ -537,7 +537,7 @@ Account.prototype.derivePath = function derivePath(path, master) { Account.prototype.deriveKey = function deriveKey(branch, index, master) { let keys = []; - let key, shared, ring; + let key, ring; assert(typeof branch === 'number'); @@ -556,7 +556,7 @@ Account.prototype.deriveKey = function deriveKey(branch, index, master) { case Account.types.MULTISIG: keys.push(key.publicKey); - for (shared of this.keys) { + for (let shared of this.keys) { shared = shared.derive(branch).derive(index); keys.push(shared.publicKey); } diff --git a/lib/wallet/http.js b/lib/wallet/http.js index 271bd209..466ce15e 100644 --- a/lib/wallet/http.js +++ b/lib/wallet/http.js @@ -615,11 +615,10 @@ HTTPServer.prototype.initRouter = function initRouter() { let acct = valid.str('account'); let coins = await req.wallet.getCoins(acct); let result = []; - let coin; common.sortCoins(coins); - for (coin of coins) + for (let coin of coins) result.push(coin.getJSON(this.network)); res.send(200, result); @@ -629,9 +628,8 @@ HTTPServer.prototype.initRouter = function initRouter() { this.get('/:id/locked', async (req, res) => { let locked = this.wallet.getLocked(); let result = []; - let outpoint; - for (outpoint of locked) + for (let outpoint of locked) result.push(outpoint.toJSON()); res.send(200, result); @@ -840,9 +838,8 @@ HTTPServer.prototype.initSockets = function initSockets() { this.walletdb.on('address', (id, receive) => { let channel = 'w:' + id; let json = []; - let addr; - for (addr of receive) + for (let addr of receive) json.push(addr.toJSON()); this.to(channel, 'wallet address', json); diff --git a/lib/wallet/wallet.js b/lib/wallet/wallet.js index 264ff272..ee4962f9 100644 --- a/lib/wallet/wallet.js +++ b/lib/wallet/wallet.js @@ -1537,13 +1537,13 @@ Wallet.prototype.estimateSize = async function estimateSize(prev) { Wallet.prototype.createTX = async function createTX(options, force) { let outputs = options.outputs; let mtx = new MTX(); - let output, addr, total; + let addr, total; assert(Array.isArray(outputs), 'Outputs must be an array.'); assert(outputs.length > 0, 'No outputs available.'); // Add the outputs - for (output of outputs) { + for (let output of outputs) { output = new Output(output); addr = output.getAddress(); diff --git a/lib/wallet/walletdb.js b/lib/wallet/walletdb.js index 8807d93e..bd044012 100644 --- a/lib/wallet/walletdb.js +++ b/lib/wallet/walletdb.js @@ -182,14 +182,12 @@ WalletDB.prototype._open = async function open() { */ WalletDB.prototype._close = async function close() { - let wallet; - await this.disconnect(); if (this.http && this.options.listen) await this.http.close(); - for (wallet of this.wallets.values()) + for (let wallet of this.wallets.values()) await wallet.destroy(); await this.db.close(); @@ -1460,15 +1458,13 @@ WalletDB.prototype.decryptKeys = async function decryptKeys(wallet, key) { */ WalletDB.prototype.resend = async function resend() { - let keys, key, wid; - - keys = await this.db.keys({ + let keys = await this.db.keys({ gte: layout.w(0x00000000), lte: layout.w(0xffffffff) }); - for (key of keys) { - wid = layout.ww(key); + for (let key of keys) { + let wid = layout.ww(key); await this.resendPending(wid); } }; @@ -1926,7 +1922,6 @@ WalletDB.prototype.addBlock = async function addBlock(entry, txs) { WalletDB.prototype._addBlock = async function addBlock(entry, txs) { let tip = BlockMeta.fromEntry(entry); let total = 0; - let tx; if (tip.height < this.state.height) { this.logger.warning( @@ -1955,7 +1950,7 @@ WalletDB.prototype._addBlock = async function addBlock(entry, txs) { return total; } - for (tx of txs) { + for (let tx of txs) { if (await this._insert(tx, tip)) total++; }