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;