added miners chart
This commit is contained in:
parent
4cc7d88235
commit
7f2f722d5d
18
lib/node.js
18
lib/node.js
@ -76,6 +76,7 @@ function Node()
|
|||||||
txDensity: [],
|
txDensity: [],
|
||||||
blockTimes: [],
|
blockTimes: [],
|
||||||
gasSpending: [],
|
gasSpending: [],
|
||||||
|
miners: [],
|
||||||
uptime: 0,
|
uptime: 0,
|
||||||
errors: []
|
errors: []
|
||||||
};
|
};
|
||||||
@ -235,6 +236,7 @@ Node.prototype.getLatestBlocks = function()
|
|||||||
this.stats.difficulty = this.difficultyChart();
|
this.stats.difficulty = this.difficultyChart();
|
||||||
this.stats.txDensity = this.txDensityChart();
|
this.stats.txDensity = this.txDensityChart();
|
||||||
this.stats.gasSpending = this.gasSpendingChart();
|
this.stats.gasSpending = this.gasSpendingChart();
|
||||||
|
this.stats.miners = this.minersChart();
|
||||||
}
|
}
|
||||||
|
|
||||||
Node.prototype.addBlockHistory = function(block)
|
Node.prototype.addBlockHistory = function(block)
|
||||||
@ -297,6 +299,22 @@ Node.prototype.gasSpendingChart = function()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Node.prototype.minersChart = function()
|
||||||
|
{
|
||||||
|
var miners = _.countBy(this.blocks, function(block)
|
||||||
|
{
|
||||||
|
return block.miner;
|
||||||
|
});
|
||||||
|
|
||||||
|
var minersArray = [];
|
||||||
|
|
||||||
|
_.forEach(miners, function(cnt, miner) {
|
||||||
|
minersArray.push({miner: miner, blocks: cnt});
|
||||||
|
});
|
||||||
|
|
||||||
|
return _.sortBy(minersArray, 'blocks').reverse();
|
||||||
|
}
|
||||||
|
|
||||||
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