From c22f6505eb688a5634456cd5f1187a44a1ddd370 Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Thu, 28 Apr 2016 12:04:07 -0400 Subject: [PATCH] bitcoind: reduce duplicate tx messages remember a larger number of tx zmq messages to not emit a transaction twice once from the block and another from the mempool --- lib/services/bitcoind.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/services/bitcoind.js b/lib/services/bitcoind.js index b749c89e..4077c848 100644 --- a/lib/services/bitcoind.js +++ b/lib/services/bitcoind.js @@ -111,7 +111,7 @@ Bitcoin.prototype._initCaches = function() { this.blockCache = LRU(144); this.rawBlockCache = LRU(72); this.blockHeaderCache = LRU(288); - this.zmqKnownTransactions = LRU(50); + this.zmqKnownTransactions = LRU(5000); this.zmqKnownBlocks = LRU(50); this.lastTip = 0; this.lastTipTimeout = false; @@ -467,7 +467,7 @@ Bitcoin.prototype._updateTip = function(node, message) { Bitcoin.prototype._zmqTransactionHandler = function(node, message) { var self = this; - var id = message.toString('binary'); + var id = bitcore.crypto.Hash.sha256sha256(message).toString('binary'); if (!self.zmqKnownTransactions.get(id)) { self.zmqKnownTransactions.set(id, true); self.emit('tx', message);