added gas spending in history

This commit is contained in:
cubedro 2015-04-28 04:49:43 +03:00
parent d1d8603fd9
commit 1e9d860c3d

View File

@ -201,6 +201,21 @@ History.prototype.getTransactionsCount = function(id)
return txCount; return txCount;
} }
History.prototype.getGasSpending = function(id)
{
var gasSpending = _(this._items)
.sortByOrder('height', false)
.slice(0, MAX_BINS - 1)
.reverse()
.map(function(item)
{
return item.block.gasUsed;
})
.value();
return gasSpending;
}
History.prototype.getDifficulty = function(id) History.prototype.getDifficulty = function(id)
{ {
var difficultyHistory = _(this._items) var difficultyHistory = _(this._items)