From 019626ba157cdb1e315196851919b678caea21bf Mon Sep 17 00:00:00 2001 From: Braydon Fuller Date: Mon, 11 Apr 2016 10:15:12 -0400 Subject: [PATCH] bitcoind: prevent rapid tip updates for all networks --- lib/services/bitcoind.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/services/bitcoind.js b/lib/services/bitcoind.js index 77cabe92..695482b9 100644 --- a/lib/services/bitcoind.js +++ b/lib/services/bitcoind.js @@ -322,19 +322,15 @@ Bitcoin.prototype._zmqBlockHandler = function(node, message) { } } - // Prevent a rapid succession of updates with regtest - if (self.node.network.regtestEnabled) { - if (new Date() - self.zmqLastBlock > 1000) { - self.zmqLastBlock = new Date(); - updateChain(); - } else { - clearTimeout(self.zmqUpdateTipTimeout); - self.zmqUpdateTipTimeout = setTimeout(function() { - updateChain(); - }, 1000); - } - } else { + // Prevent a rapid succession of updates + if (new Date() - self.zmqLastBlock > 1000) { + self.zmqLastBlock = new Date(); updateChain(); + } else { + clearTimeout(self.zmqUpdateTipTimeout); + self.zmqUpdateTipTimeout = setTimeout(function() { + updateChain(); + }, 1000); } // Notify block subscribers