added txCount
This commit is contained in:
parent
a7dd2ab04c
commit
63307f35bb
17
lib/node.js
17
lib/node.js
@ -42,6 +42,7 @@ function Node()
|
||||
block: {},
|
||||
blocktimeAvg: 0,
|
||||
difficulty: [],
|
||||
txDensity: [],
|
||||
uptime: 0,
|
||||
errors: []
|
||||
};
|
||||
@ -145,6 +146,13 @@ Node.prototype.getBlock = function(number)
|
||||
if(block.hash != '?' && typeof block.difficulty !== 'undefined')
|
||||
{
|
||||
block.difficulty = web3.toDecimal(block.difficulty);
|
||||
|
||||
try {
|
||||
block.txCount = web3.eth.transactionCount(block.hash);
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
@ -180,6 +188,7 @@ Node.prototype.getLatestBlocks = function()
|
||||
this.calculateBlockTimes();
|
||||
this.stats.blocktimeAvg = this.blockTimesAvg();
|
||||
this.stats.difficulty = this.difficultyChart();
|
||||
this.stats.txDensity = this.txDensityChart();
|
||||
}
|
||||
|
||||
Node.prototype.addBlockHistory = function(block)
|
||||
@ -227,6 +236,14 @@ Node.prototype.difficultyChart = function()
|
||||
});
|
||||
}
|
||||
|
||||
Node.prototype.txDensityChart = function()
|
||||
{
|
||||
return txDensity = _.map(this.blocks, function(block)
|
||||
{
|
||||
return block.txCount;
|
||||
});
|
||||
}
|
||||
|
||||
Node.prototype.uptime = function()
|
||||
{
|
||||
this.stats.uptime = ((this._tries - this._down) / this._tries) * 100;
|
||||
|
Loading…
Reference in New Issue
Block a user