diff --git a/lib/node.js b/lib/node.js index 125cce59..a3200fda 100644 --- a/lib/node.js +++ b/lib/node.js @@ -50,6 +50,17 @@ var BitcoreNode = function(bus, networkMonitor, blockService, transactionService }); }); */ + + setInterval(function() { + if (!self.blockchain) { + // not ready yet + return; + } + var tipHash = self.blockchain.tip; + var block = self.blockCache[tipHash]; + console.log('block', block.id, 'height', block.height); + }, 5 * 1000); + this.bus.register(bitcore.Block, function(block) { var prevHash = bitcore.util.buffer.reverse(block.header.prevHash).toString('hex'); @@ -65,10 +76,6 @@ var BitcoreNode = function(bus, networkMonitor, blockService, transactionService block.height = self.blockchain.height[block.id]; block.work = self.blockchain.work[block.id]; - if (block.height % 100 === 0) { - console.log('block', block.id, 'height', block.height); - } - return Promise.each(blockchainChanges.unconfirmed, function(hash) { return self.blockService.unconfirm(self.blockCache[hash]); })