test: mark last zmq block before rpc calls

This commit is contained in:
Braydon Fuller 2016-04-07 15:00:09 -04:00
parent 31da32ecfd
commit c4649c9b13

View File

@ -242,7 +242,6 @@ Bitcoin.prototype._zmqBlockHandler = function(node, message) {
return log.error(err); return log.error(err);
} }
self.height = response.result.height; self.height = response.result.height;
self.zmqLastBlock = new Date();
$.checkState(self.height >= 0); $.checkState(self.height >= 0);
self.emit('tip', self.height); self.emit('tip', self.height);
}); });
@ -261,6 +260,7 @@ Bitcoin.prototype._zmqBlockHandler = function(node, message) {
// Prevent a rapid succession of updates with regtest // Prevent a rapid succession of updates with regtest
if (self.node.network.regtestEnabled) { if (self.node.network.regtestEnabled) {
if (new Date() - self.zmqLastBlock > 1000) { if (new Date() - self.zmqLastBlock > 1000) {
self.zmqLastBlock = new Date();
updateChain(); updateChain();
} else { } else {
clearTimeout(self.zmqUpdateTipTimeout); clearTimeout(self.zmqUpdateTipTimeout);