bitcoind: prevent rapid tip updates for all networks

This commit is contained in:
Braydon Fuller 2016-04-11 10:15:12 -04:00
parent 5bea36edc6
commit 019626ba15
1 changed files with 8 additions and 12 deletions

View File

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