From 797016630c92dd4021ad967a86354f96864954d1 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 9 Jul 2017 13:17:43 -0700 Subject: [PATCH] chaindb: minor. --- lib/blockchain/chaindb.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/blockchain/chaindb.js b/lib/blockchain/chaindb.js index c560c108..f8552544 100644 --- a/lib/blockchain/chaindb.js +++ b/lib/blockchain/chaindb.js @@ -1467,8 +1467,10 @@ ChainDB.prototype.saveUpdates = function saveUpdates() { this.logger.info('Saving %d state cache updates.', updates.length); - for (let update of updates) - this.put(layout.v(update.bit, update.hash), update.toRaw()); + for (let update of updates) { + let {bit, hash} = update; + this.put(layout.v(bit, hash), update.toRaw()); + } }; /** @@ -2122,9 +2124,9 @@ StateCache.prototype._init = function _init() { for (let i = 0; i < 32; i++) this.bits.push(null); - for (let deployment of this.network.deploys) { - assert(!this.bits[deployment.bit]); - this.bits[deployment.bit] = new Map(); + for (let {bit} of this.network.deploys) { + assert(!this.bits[bit]); + this.bits[bit] = new Map(); } }; @@ -2158,12 +2160,10 @@ StateCache.prototype.commit = function commit() { }; StateCache.prototype.drop = function drop() { - let update, cache; - - for (update of this.updates) { - cache = this.bits[update.bit]; + for (let {bit, hash} of this.updates) { + let cache = this.bits[bit]; assert(cache); - cache.delete(update.hash); + cache.delete(hash); } this.updates.length = 0;