diff --git a/lib/blockchain/chaindb.js b/lib/blockchain/chaindb.js index 3887cac0..5f4b600b 100644 --- a/lib/blockchain/chaindb.js +++ b/lib/blockchain/chaindb.js @@ -83,17 +83,14 @@ function ChainDB(chain) { this.cacheWindow = (this.network.pow.retargetInterval + 1) * 2 + 100; // 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.cacheHash = new LRU(this.cacheWindow); this.cacheHeight = new LRU(this.cacheWindow); - if (chain.options.coinCache) { - assert(typeof chain.options.coinCache === 'number'); - this.coinWindow = chain.options.coinCache; + if (this.coinWindow) this.coinCache = new LRU(this.coinWindow, getSize); - } } util.inherits(ChainDB, AsyncObject); diff --git a/lib/net/pool.js b/lib/net/pool.js index 2d73262f..a7f6279e 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -850,7 +850,7 @@ Pool.prototype._handleBlocks = co(function* _handleBlocks(hashes, peer) { // hash. this.logger.debug('Received known orphan hash (%s).', peer.hostname); yield peer.resolveOrphan(null, hash); - continue; + break; } exists = yield this.getBlock(peer, hash);