added difficulty chart in history
This commit is contained in:
parent
f2a7f31b64
commit
d1d8603fd9
@ -33,7 +33,7 @@ var History = function History(data)
|
|||||||
|
|
||||||
History.prototype.add = function(block, id)
|
History.prototype.add = function(block, id)
|
||||||
{
|
{
|
||||||
if(typeof block !== 'undefined' && typeof block.number !== 'undefined' && typeof block.uncles !== 'undefined' && typeof block.transactions !== 'undefined')
|
if(typeof block !== 'undefined' && typeof block.number !== 'undefined' && typeof block.uncles !== 'undefined' && typeof block.transactions !== 'undefined' && typeof block.difficulty !== 'undefined')
|
||||||
{
|
{
|
||||||
var historyBlock = this.search(block.number);
|
var historyBlock = this.search(block.number);
|
||||||
|
|
||||||
@ -201,6 +201,21 @@ History.prototype.getTransactionsCount = function(id)
|
|||||||
return txCount;
|
return txCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
History.prototype.getDifficulty = function(id)
|
||||||
|
{
|
||||||
|
var difficultyHistory = _(this._items)
|
||||||
|
.sortByOrder('height', false)
|
||||||
|
.slice(0, MAX_BINS - 1)
|
||||||
|
.reverse()
|
||||||
|
.map(function(item)
|
||||||
|
{
|
||||||
|
return item.block.difficulty;
|
||||||
|
})
|
||||||
|
.value();
|
||||||
|
|
||||||
|
return difficultyHistory;
|
||||||
|
}
|
||||||
|
|
||||||
History.prototype.history = function()
|
History.prototype.history = function()
|
||||||
{
|
{
|
||||||
return _.chain(this._items).sortBy('number').reverse().value();
|
return _.chain(this._items).sortBy('number').reverse().value();
|
||||||
|
Loading…
Reference in New Issue
Block a user