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: {},
|
block: {},
|
||||||
blocktimeAvg: 0,
|
blocktimeAvg: 0,
|
||||||
difficulty: [],
|
difficulty: [],
|
||||||
|
txDensity: [],
|
||||||
uptime: 0,
|
uptime: 0,
|
||||||
errors: []
|
errors: []
|
||||||
};
|
};
|
||||||
@ -145,6 +146,13 @@ Node.prototype.getBlock = function(number)
|
|||||||
if(block.hash != '?' && typeof block.difficulty !== 'undefined')
|
if(block.hash != '?' && typeof block.difficulty !== 'undefined')
|
||||||
{
|
{
|
||||||
block.difficulty = web3.toDecimal(block.difficulty);
|
block.difficulty = web3.toDecimal(block.difficulty);
|
||||||
|
|
||||||
|
try {
|
||||||
|
block.txCount = web3.eth.transactionCount(block.hash);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@ -180,6 +188,7 @@ Node.prototype.getLatestBlocks = function()
|
|||||||
this.calculateBlockTimes();
|
this.calculateBlockTimes();
|
||||||
this.stats.blocktimeAvg = this.blockTimesAvg();
|
this.stats.blocktimeAvg = this.blockTimesAvg();
|
||||||
this.stats.difficulty = this.difficultyChart();
|
this.stats.difficulty = this.difficultyChart();
|
||||||
|
this.stats.txDensity = this.txDensityChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
Node.prototype.addBlockHistory = function(block)
|
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()
|
Node.prototype.uptime = function()
|
||||||
{
|
{
|
||||||
this.stats.uptime = ((this._tries - this._down) / this._tries) * 100;
|
this.stats.uptime = ((this._tries - this._down) / this._tries) * 100;
|
||||||
|
Loading…
Reference in New Issue
Block a user