From 8bd52cff0a753d5f6a0bd25b71998ca5249e0cca Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 25 Jul 2016 01:20:26 -0700 Subject: [PATCH] chaindb: cache 25mb of coins. --- lib/bcoin/chaindb.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/bcoin/chaindb.js b/lib/bcoin/chaindb.js index 6d35bb9f..9ffe5be8 100644 --- a/lib/bcoin/chaindb.js +++ b/lib/bcoin/chaindb.js @@ -199,15 +199,7 @@ function ChainDB(chain, options) { this.cacheWindow = (this.network.pow.retargetInterval + 1) * 2 + 100; // We want to keep the last 5 blocks of unspents in memory. - // Some explanation for the numbers: - // Average block output size: 165kb - // Average number of outputs: 5000 - // Average output size: 33.6b - // Average number of outputs per tx: 2.2 - // Average size of outputs per tx: 74b - // Average number of txs: 2300 - // Key size: 66b (* 2) - this.coinWindow = ((165 * 1024 + 2300 * 4) + (2300 * 66 * 2)) * 5; + this.coinWindow = 25 << 20; this.coinCache = new bcoin.lru.nil(); this.cacheHash = new bcoin.lru(this.cacheWindow, 1);