fixed last block time bug

pull/5/head
cubedro 10 years ago
parent 2b410d8e5d
commit 63427abc51
  1. 16
      public/js/controllers.js
  2. 2
      views/index.jade

@ -127,6 +127,20 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr)
var index = findIndex({id: data.id}); var index = findIndex({id: data.id});
if(typeof $scope.nodes[index].stats !== 'undefined') { if(typeof $scope.nodes[index].stats !== 'undefined') {
if($scope.nodes[index].stats.block.number < data.stats.block.number)
{
var best = _.max($scope.nodes, function(node) {
return parseInt(node.stats.block.number);
}).stats.block;
if (data.stats.block.number > best.number) {
data.stats.block.arrived = _.now();
} else {
data.stats.block.arrived = best.arrived;
}
}
$scope.nodes[index].stats = data.stats; $scope.nodes[index].stats = data.stats;
$scope.nodes[index].history = data.history; $scope.nodes[index].history = data.history;
makePeerPropagationChart($scope.nodes[index]); makePeerPropagationChart($scope.nodes[index]);
@ -285,7 +299,7 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, socket, _, toastr)
return parseInt(node.stats.block.number); return parseInt(node.stats.block.number);
}).stats; }).stats;
$scope.lastBlock = $scope.bestStats.block.received; $scope.lastBlock = $scope.bestStats.block.arrived;
$scope.lastDifficulty = $scope.bestStats.block.difficulty; $scope.lastDifficulty = $scope.bestStats.block.difficulty;
} }

@ -195,7 +195,7 @@ block content
span.small {{node.stats.block.hash | hashFilter}} span.small {{node.stats.block.hash | hashFilter}}
td(style="padding-left: 14px;") {{node.stats.block.transactions.length || 0}} td(style="padding-left: 14px;") {{node.stats.block.transactions.length || 0}}
td(style="padding-left: 14px;") {{node.stats.block.uncles.length || 0}} td(style="padding-left: 14px;") {{node.stats.block.uncles.length || 0}}
td(class="{{ node.stats.block.arrived | timeClass : node.stats.active }}") {{node.stats.block.arrived | blockTimeFilter }} td(class="{{ node.stats.block.received | timeClass : node.stats.active }}") {{node.stats.block.received | blockTimeFilter }}
td(class="{{ node.stats | propagationTimeClass : bestBlock }}") td(class="{{ node.stats | propagationTimeClass : bestBlock }}")
div.propagationBox div.propagationBox
span {{node.stats.block.propagation | blockPropagationFilter}} span {{node.stats.block.propagation | blockPropagationFilter}}

Loading…
Cancel
Save