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
This commit is contained in:
Braydon Fuller 2016-04-28 12:04:07 -04:00
parent d969ad7fb6
commit c22f6505eb

View File

@ -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);