From 645912a08660b5fd55b4b7d9b0aede36eeb87aaf Mon Sep 17 00:00:00 2001 From: cubedro Date: Tue, 7 Apr 2015 19:46:05 +0300 Subject: [PATCH] improved pending tx --- lib/node.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/node.js b/lib/node.js index 09bd420..bb167ca 100644 --- a/lib/node.js +++ b/lib/node.js @@ -418,6 +418,19 @@ Node.prototype.update = function() return this.stats; }; +Node.prototype.updatePending = function() +{ + if(PENDING_WORKS) { + try { + this.stats.pending = web3.eth.getBlockTransactionCount('pending'); + this.sendUpdate(); + } catch (err) { + PENDING_WORKS = false; + console.error("getBlockTransactionCount('pending'):", err); + } + } +} + Node.prototype.ping = function() { this._latency = (new Date()).getTime(); @@ -432,7 +445,7 @@ Node.prototype.setWatches = function() this.pendingFilter.watch( function(log) { if(PENDING_WORKS) { debounce(function() { - self.update(); + self.updatePending(); }, 50); } });