chaindb: minor.

This commit is contained in:
Christopher Jeffrey 2016-12-04 18:09:33 -08:00
parent 72b68532e3
commit f45ce12bec
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 3 additions and 6 deletions

View File

@ -83,17 +83,14 @@ function ChainDB(chain) {
this.cacheWindow = (this.network.pow.retargetInterval + 1) * 2 + 100; this.cacheWindow = (this.network.pow.retargetInterval + 1) * 2 + 100;
// We want to keep the last 5 blocks of unspents in memory. // We want to keep the last 5 blocks of unspents in memory.
this.coinWindow = 0; this.coinWindow = chain.options.coinCache || 0;
this.coinCache = new LRU.Nil(); this.coinCache = new LRU.Nil();
this.cacheHash = new LRU(this.cacheWindow); this.cacheHash = new LRU(this.cacheWindow);
this.cacheHeight = new LRU(this.cacheWindow); this.cacheHeight = new LRU(this.cacheWindow);
if (chain.options.coinCache) { if (this.coinWindow)
assert(typeof chain.options.coinCache === 'number');
this.coinWindow = chain.options.coinCache;
this.coinCache = new LRU(this.coinWindow, getSize); this.coinCache = new LRU(this.coinWindow, getSize);
}
} }
util.inherits(ChainDB, AsyncObject); util.inherits(ChainDB, AsyncObject);

View File

@ -850,7 +850,7 @@ Pool.prototype._handleBlocks = co(function* _handleBlocks(hashes, peer) {
// hash. // hash.
this.logger.debug('Received known orphan hash (%s).', peer.hostname); this.logger.debug('Received known orphan hash (%s).', peer.hostname);
yield peer.resolveOrphan(null, hash); yield peer.resolveOrphan(null, hash);
continue; break;
} }
exists = yield this.getBlock(peer, hash); exists = yield this.getBlock(peer, hash);