bitcoind: prevent rapid tip updates for all networks
This commit is contained in:
parent
5bea36edc6
commit
019626ba15
|
@ -322,19 +322,15 @@ Bitcoin.prototype._zmqBlockHandler = function(node, message) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent a rapid succession of updates with regtest
|
// Prevent a rapid succession of updates
|
||||||
if (self.node.network.regtestEnabled) {
|
if (new Date() - self.zmqLastBlock > 1000) {
|
||||||
if (new Date() - self.zmqLastBlock > 1000) {
|
self.zmqLastBlock = new Date();
|
||||||
self.zmqLastBlock = new Date();
|
|
||||||
updateChain();
|
|
||||||
} else {
|
|
||||||
clearTimeout(self.zmqUpdateTipTimeout);
|
|
||||||
self.zmqUpdateTipTimeout = setTimeout(function() {
|
|
||||||
updateChain();
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
updateChain();
|
updateChain();
|
||||||
|
} else {
|
||||||
|
clearTimeout(self.zmqUpdateTipTimeout);
|
||||||
|
self.zmqUpdateTipTimeout = setTimeout(function() {
|
||||||
|
updateChain();
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify block subscribers
|
// Notify block subscribers
|
||||||
|
|
Loading…
Reference in New Issue