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:
parent
d969ad7fb6
commit
c22f6505eb
@ -111,7 +111,7 @@ Bitcoin.prototype._initCaches = function() {
|
|||||||
this.blockCache = LRU(144);
|
this.blockCache = LRU(144);
|
||||||
this.rawBlockCache = LRU(72);
|
this.rawBlockCache = LRU(72);
|
||||||
this.blockHeaderCache = LRU(288);
|
this.blockHeaderCache = LRU(288);
|
||||||
this.zmqKnownTransactions = LRU(50);
|
this.zmqKnownTransactions = LRU(5000);
|
||||||
this.zmqKnownBlocks = LRU(50);
|
this.zmqKnownBlocks = LRU(50);
|
||||||
this.lastTip = 0;
|
this.lastTip = 0;
|
||||||
this.lastTipTimeout = false;
|
this.lastTipTimeout = false;
|
||||||
@ -467,7 +467,7 @@ Bitcoin.prototype._updateTip = function(node, message) {
|
|||||||
|
|
||||||
Bitcoin.prototype._zmqTransactionHandler = function(node, message) {
|
Bitcoin.prototype._zmqTransactionHandler = function(node, message) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var id = message.toString('binary');
|
var id = bitcore.crypto.Hash.sha256sha256(message).toString('binary');
|
||||||
if (!self.zmqKnownTransactions.get(id)) {
|
if (!self.zmqKnownTransactions.get(id)) {
|
||||||
self.zmqKnownTransactions.set(id, true);
|
self.zmqKnownTransactions.set(id, true);
|
||||||
self.emit('tx', message);
|
self.emit('tx', message);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user