From 1e9d860c3d6dd4092687de0ef8d3f90851c4c565 Mon Sep 17 00:00:00 2001 From: cubedro Date: Tue, 28 Apr 2015 04:49:43 +0300 Subject: [PATCH] added gas spending in history --- models/history.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/models/history.js b/models/history.js index 1c2375a..dcdfaca 100644 --- a/models/history.js +++ b/models/history.js @@ -201,6 +201,21 @@ History.prototype.getTransactionsCount = function(id) 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) { var difficultyHistory = _(this._items)