From 4211499b0e3b311367caa0f69abc27dd31e6cd1e Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Mon, 20 Oct 2014 08:53:54 -0700 Subject: [PATCH] garbage collection. --- lib/bitcoind.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/bitcoind.js b/lib/bitcoind.js index a7e04cb2..1c52411d 100644 --- a/lib/bitcoind.js +++ b/lib/bitcoind.js @@ -306,6 +306,9 @@ Bitcoin.prototype._pollBlocks = function() { // XXX Bad workaround if (self._emitted[block.hash]) { + if (Object.keys(self._emitted[block.hash]).length > 10000) { + self._emitted = {}; + } return setImmediate(function() { return nextBlock(); }); @@ -353,6 +356,9 @@ Bitcoin.prototype._pollMempool = function() { // XXX Bad workaround if (self._emitted[tx.txid]) { + if (Object.keys(self._emitted[block.hash]).length > 10000) { + self._emitted = {}; + } return setImmediate(function() { return nextTx(); });