From 5e7c3a3040b1fb590db969e0f870802a70709ecd Mon Sep 17 00:00:00 2001 From: cubedro Date: Mon, 1 Jun 2015 22:41:35 +0300 Subject: [PATCH] added get pending tx after chain event --- lib/node.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/node.js b/lib/node.js index b0dbb89..b4a3fa0 100644 --- a/lib/node.js +++ b/lib/node.js @@ -435,10 +435,6 @@ Node.prototype.getStats = function(forced) { web3.net.getPeerCount(callback); }, - pending: function (callback) - { - web3.eth.getBlockTransactionCount('pending', callback); - }, mining: function (callback) { web3.eth.getMining(callback); @@ -473,7 +469,6 @@ Node.prototype.getStats = function(forced) { self.stats.active = true; self.stats.peers = results.peers; - self.stats.pending = results.pending; self.stats.mining = results.mining; self.stats.hashrate = results.hashrate; self.stats.gasPrice = results.gasPrice.toString(10); @@ -512,8 +507,7 @@ Node.prototype.getPending = function() results.end = _.now(); results.diff = results.end - now; - console.success('==>', 'Got getPending results in', chalk.reset.cyan(results.diff, 'ms')); - console.log(pending); + console.success('==>', 'Got', chalk.reset.red(pending) , chalk.reset.bold.green('pending tx'+ (pending === 1 ? '' : 's') + ' in'), chalk.reset.cyan(results.diff, 'ms')); self.stats.pending = pending; @@ -661,6 +655,8 @@ Node.prototype.setWatches = function() this._latestQueue.drain = function() { console.success("Finished processing", 'latest', 'queue'); + + self.getPending(); } try { @@ -694,12 +690,12 @@ Node.prototype.setWatches = function() if(time > 50) { - self.getPending(true); + self.getPending(); } else { debounce(function() { - self.getPending(true); + self.getPending(); }, 50); } });