Merge pull request #32 from cubedro/develop

Fixed pending for geth
This commit is contained in:
Marian OANCΞA 2015-04-03 01:13:55 +03:00
commit c730659c18
3 changed files with 14 additions and 6 deletions

View File

@ -11,7 +11,7 @@ sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get update -y sudo apt-get update -y
# install ethereum # install ethereum
sudo apt-get install -y ethereum sudo apt-get install -y geth
# add node symlink # add node symlink
sudo ln -s /usr/bin/nodejs /usr/bin/node sudo ln -s /usr/bin/nodejs /usr/bin/node

View File

@ -55,6 +55,7 @@ npm install
npm install pm2 -g npm install pm2 -g
cp -b ./processes.json ./.. cp -b ./processes.json ./..
# set up time update cronjob # set up time update cronjob
cat > /etc/cron.hourly/ntpdate << EOF cat > /etc/cron.hourly/ntpdate << EOF
#!/bin/sh #!/bin/sh

View File

@ -30,6 +30,7 @@ if(process.env.NODE_ENV === 'production' && INSTANCE_NAME === "")
var socket = new Socket(process.env.WS_SERVER || 'ws://localhost:3000'); 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 WS_SECRET = process.env.WS_SECRET || "eth-net-stats-has-a-secret";
var PENDING_WORKS = true;
var MAX_BLOCKS_HISTORY = 36; var MAX_BLOCKS_HISTORY = 36;
var UPDATE_INTERVAL = 5000; var UPDATE_INTERVAL = 5000;
var PING_INTERVAL = 2000; var PING_INTERVAL = 2000;
@ -307,11 +308,15 @@ Node.prototype.getStats = function()
if(this.stats.block.number > 0) if(this.stats.block.number > 0)
this.getLatestBlocks(); this.getLatestBlocks();
try { if(PENDING_WORKS) {
this.stats.pending = web3.eth.getBlockTransactionCount('pending'); try {
} catch (err) { this.stats.pending = web3.eth.getBlockTransactionCount('pending');
console.error("getBlockTransactionCount('pending'):", err); } catch (err) {
PENDING_WORKS = false;
console.error("getBlockTransactionCount('pending'):", err);
}
} }
this.stats.mining = web3.eth.mining; this.stats.mining = web3.eth.mining;
this.stats.gasPrice = web3.eth.gasPrice.toString(10); this.stats.gasPrice = web3.eth.gasPrice.toString(10);
this.stats.listening = web3.net.listening; this.stats.listening = web3.net.listening;
@ -368,7 +373,9 @@ Node.prototype.setWatches = function()
this.pendingFilter = web3.eth.filter('pending'); this.pendingFilter = web3.eth.filter('pending');
this.pendingFilter.watch( function(log) { this.pendingFilter.watch( function(log) {
self.update(); if(PENDING_WORKS) {
self.update();
}
}); });
this.chainFilter = web3.eth.filter('latest'); this.chainFilter = web3.eth.filter('latest');