From 1adb7700db7d3e1cc611c665972696000410f50d Mon Sep 17 00:00:00 2001 From: cubedro Date: Fri, 3 Apr 2015 01:09:17 +0300 Subject: [PATCH 1/3] build fixes --- bin/build-go.sh | 2 +- bin/build.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/build-go.sh b/bin/build-go.sh index f2f8982..e0ed8c9 100644 --- a/bin/build-go.sh +++ b/bin/build-go.sh @@ -11,7 +11,7 @@ sudo add-apt-repository -y ppa:ethereum/ethereum-dev sudo apt-get update -y # install ethereum -sudo apt-get install -y ethereum +sudo apt-get install -y geth # add node symlink sudo ln -s /usr/bin/nodejs /usr/bin/node diff --git a/bin/build.sh b/bin/build.sh index faff6df..8114b49 100644 --- a/bin/build.sh +++ b/bin/build.sh @@ -55,6 +55,7 @@ npm install npm install pm2 -g cp -b ./processes.json ./.. + # set up time update cronjob cat > /etc/cron.hourly/ntpdate << EOF #!/bin/sh From 4361ea9d4b17696377d0689e7303abc3e12ad5ab Mon Sep 17 00:00:00 2001 From: cubedro Date: Fri, 3 Apr 2015 01:12:28 +0300 Subject: [PATCH 2/3] added PENDING_WORKS flag --- lib/node.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/node.js b/lib/node.js index 71b5b41..42b64bc 100644 --- a/lib/node.js +++ b/lib/node.js @@ -30,6 +30,7 @@ if(process.env.NODE_ENV === 'production' && INSTANCE_NAME === "") var socket = new Socket(process.env.WS_SERVER || 'ws://localhost:3000'); var WS_SECRET = process.env.WS_SECRET || "eth-net-stats-has-a-secret"; +var PENDING_WORKS = true; var MAX_BLOCKS_HISTORY = 36; var UPDATE_INTERVAL = 5000; var PING_INTERVAL = 2000; @@ -307,11 +308,15 @@ Node.prototype.getStats = function() if(this.stats.block.number > 0) this.getLatestBlocks(); - try { - this.stats.pending = web3.eth.getBlockTransactionCount('pending'); - } catch (err) { - console.error("getBlockTransactionCount('pending'):", err); + if(PENDING_WORKS) { + try { + this.stats.pending = web3.eth.getBlockTransactionCount('pending'); + } catch (err) { + PENDING_WORKS = false; + console.error("getBlockTransactionCount('pending'):", err); + } } + this.stats.mining = web3.eth.mining; this.stats.gasPrice = web3.eth.gasPrice.toString(10); this.stats.listening = web3.net.listening; From 76f2f2866555a603880abafc42c83ff06dcf23f9 Mon Sep 17 00:00:00 2001 From: cubedro Date: Fri, 3 Apr 2015 01:13:22 +0300 Subject: [PATCH 3/3] added PENDING_WORKS to filter too --- lib/node.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/node.js b/lib/node.js index 42b64bc..5bb5d41 100644 --- a/lib/node.js +++ b/lib/node.js @@ -373,7 +373,9 @@ Node.prototype.setWatches = function() this.pendingFilter = web3.eth.filter('pending'); this.pendingFilter.watch( function(log) { - self.update(); + if(PENDING_WORKS) { + self.update(); + } }); this.chainFilter = web3.eth.filter('latest');