added get pending tx after chain event

This commit is contained in:
cubedro 2015-06-01 22:41:35 +03:00
parent 781c839dd4
commit 5e7c3a3040

View File

@ -435,10 +435,6 @@ Node.prototype.getStats = function(forced)
{ {
web3.net.getPeerCount(callback); web3.net.getPeerCount(callback);
}, },
pending: function (callback)
{
web3.eth.getBlockTransactionCount('pending', callback);
},
mining: function (callback) mining: function (callback)
{ {
web3.eth.getMining(callback); web3.eth.getMining(callback);
@ -473,7 +469,6 @@ Node.prototype.getStats = function(forced)
{ {
self.stats.active = true; self.stats.active = true;
self.stats.peers = results.peers; self.stats.peers = results.peers;
self.stats.pending = results.pending;
self.stats.mining = results.mining; self.stats.mining = results.mining;
self.stats.hashrate = results.hashrate; self.stats.hashrate = results.hashrate;
self.stats.gasPrice = results.gasPrice.toString(10); self.stats.gasPrice = results.gasPrice.toString(10);
@ -512,8 +507,7 @@ Node.prototype.getPending = function()
results.end = _.now(); results.end = _.now();
results.diff = results.end - now; results.diff = results.end - now;
console.success('==>', 'Got getPending results in', chalk.reset.cyan(results.diff, 'ms')); console.success('==>', 'Got', chalk.reset.red(pending) , chalk.reset.bold.green('pending tx'+ (pending === 1 ? '' : 's') + ' in'), chalk.reset.cyan(results.diff, 'ms'));
console.log(pending);
self.stats.pending = pending; self.stats.pending = pending;
@ -661,6 +655,8 @@ Node.prototype.setWatches = function()
this._latestQueue.drain = function() this._latestQueue.drain = function()
{ {
console.success("Finished processing", 'latest', 'queue'); console.success("Finished processing", 'latest', 'queue');
self.getPending();
} }
try { try {
@ -694,12 +690,12 @@ Node.prototype.setWatches = function()
if(time > 50) if(time > 50)
{ {
self.getPending(true); self.getPending();
} }
else else
{ {
debounce(function() { debounce(function() {
self.getPending(true); self.getPending();
}, 50); }, 50);
} }
}); });