diff --git a/lib/node.js b/lib/node.js index 026acbe..99d83f4 100644 --- a/lib/node.js +++ b/lib/node.js @@ -82,8 +82,8 @@ function Node() this.blocks = []; this._socket = null; - this.pendingWatch = false; - this.chainWatch = false; + this.pendingFilter = false; + this.chainFilter = false; this.updateInterval = false; socket.on('open', function open() { @@ -343,19 +343,18 @@ Node.prototype.setWatches = function() { var self = this; - // this.pendingWatch = web3.eth.filter('pending'); - // this.pendingWatch.watch( function(log) { - // console.log(log); - // // console.log(self.pendingWatch.get()); - // // console.log('pending changed'); - // // self.stats.pending = parseInt(log.number); - // }); + this.pendingFilter = web3.eth.filter('pending'); + this.pendingFilter.watch( function(log) { + console.log('pending changed', log); + // console.log(self.pendingFilter.get()); + // self.stats.pending = parseInt(log.number); + }); - // this.chainWatch = web3.eth.watch('chain'); - // this.chainWatch.messages(function(log) { - // // console.log('block changed'); - // self.update(); - // }); + this.chainFilter = web3.eth.filter('latest'); + this.chainFilter.watch(function(log) { + console.log('block changed:', log); + // self.update(); + }); this.updateInterval = setInterval(function(){ self.update(); @@ -390,12 +389,6 @@ Node.prototype.stop = function() clearInterval(this.updateInterval); web3.reset(); - - // if(this.pendingWatch) - // this.pendingWatch.stopWatching(); - - // if(this.chainWatch) - // this.chainWatch.uninstall(); } module.exports = Node; \ No newline at end of file