From 15d64ad1f277084c6d236bad6d5533060ed576fe Mon Sep 17 00:00:00 2001 From: cubedro Date: Thu, 30 Jul 2015 20:34:34 +0300 Subject: [PATCH] added more nodes to config --- lib/utils/config.js | 4 ++ src/js/controllers.js | 116 +++++++++++++++++++++--------------------- 2 files changed, 62 insertions(+), 58 deletions(-) diff --git a/lib/utils/config.js b/lib/utils/config.js index 35a3a98..45e0270 100644 --- a/lib/utils/config.js +++ b/lib/utils/config.js @@ -10,6 +10,10 @@ var trusted = [ '52.7.205.152', '52.7.224.174', '92.51.165.126', + '84.117.82.122', + '73.40.58.88', + '178.19.221.38', + '185.37.145.18', '::ffff:127.0.0.1', ]; diff --git a/src/js/controllers.js b/src/js/controllers.js index cf7218e..7246095 100644 --- a/src/js/controllers.js +++ b/src/js/controllers.js @@ -474,7 +474,7 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, $localStorage, soc $scope.nodesTotal = $scope.nodes.length; $scope.nodesActive = _.filter($scope.nodes, function (node) { - forkFilter(node); + // forkFilter(node); return node.stats.active == true; }).length; @@ -510,37 +510,37 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, $localStorage, soc var chains = {}; var maxScore = 0; - _($scope.nodes) - .map(function (item) - { - maxScore += (item.trusted ? 50 : 1); - - if( _.isUndefined(chains[item.stats.block.number]) ) - chains[item.stats.block.number] = []; - - if( _.isUndefined(chains[item.stats.block.number][item.stats.block.fork]) ) - chains[item.stats.block.number][item.stats.block.fork] = { - fork: item.stats.block.fork, - count: 0, - trusted: 0, - score: 0 - }; - - if(item.stats.block.trusted) - chains[item.stats.block.number][item.stats.block.fork].trusted++; - else - chains[item.stats.block.number][item.stats.block.fork].count++; - - chains[item.stats.block.number][item.stats.block.fork].score = chains[item.stats.block.number][item.stats.block.fork].trusted * 50 + chains[item.stats.block.number][item.stats.block.fork].count; - }) - .value(); - - $scope.maxScore = maxScore; - $scope.chains = _.reduce(chains, function (result, item, key) - { - result[key] = _.max(item, 'score'); - return result; - }, {}); + // _($scope.nodes) + // .map(function (item) + // { + // maxScore += (item.trusted ? 50 : 1); + + // if( _.isUndefined(chains[item.stats.block.number]) ) + // chains[item.stats.block.number] = []; + + // if( _.isUndefined(chains[item.stats.block.number][item.stats.block.fork]) ) + // chains[item.stats.block.number][item.stats.block.fork] = { + // fork: item.stats.block.fork, + // count: 0, + // trusted: 0, + // score: 0 + // }; + + // if(item.stats.block.trusted) + // chains[item.stats.block.number][item.stats.block.fork].trusted++; + // else + // chains[item.stats.block.number][item.stats.block.fork].count++; + + // chains[item.stats.block.number][item.stats.block.fork].score = chains[item.stats.block.number][item.stats.block.fork].trusted * 50 + chains[item.stats.block.number][item.stats.block.fork].count; + // }) + // .value(); + + // $scope.maxScore = maxScore; + // $scope.chains = _.reduce(chains, function (result, item, key) + // { + // result[key] = _.max(item, 'score'); + // return result; + // }, {}); var bestBlock = _.max($scope.nodes, function (node) { @@ -565,40 +565,40 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, $localStorage, soc } } - function forkFilter(node) - { - if( _.isUndefined(node.readable) ) - node.readable = {}; + // function forkFilter(node) + // { + // if( _.isUndefined(node.readable) ) + // node.readable = {}; - node.readable.forkClass = 'hidden'; - node.readable.forkMessage = ''; + // node.readable.forkClass = 'hidden'; + // node.readable.forkMessage = ''; - return true; + // return true; - if( $scope.chains[node.stats.block.number].fork === node.stats.block.fork && $scope.chains[node.stats.block.number].score / $scope.maxScore >= 0.5 ) - { - node.readable.forkClass = 'hidden'; - node.readable.forkMessage = ''; + // if( $scope.chains[node.stats.block.number].fork === node.stats.block.fork && $scope.chains[node.stats.block.number].score / $scope.maxScore >= 0.5 ) + // { + // node.readable.forkClass = 'hidden'; + // node.readable.forkMessage = ''; - return true; - } + // return true; + // } - if( $scope.chains[node.stats.block.number].fork !== node.stats.block.fork ) - { - node.readable.forkClass = 'text-danger'; - node.readable.forkMessage = 'Wrong chain.
This chain is a fork.'; + // if( $scope.chains[node.stats.block.number].fork !== node.stats.block.fork ) + // { + // node.readable.forkClass = 'text-danger'; + // node.readable.forkMessage = 'Wrong chain.
This chain is a fork.'; - return false; - } + // return false; + // } - if( $scope.chains[node.stats.block.number].score / $scope.maxScore < 0.5) - { - node.readable.forkClass = 'text-warning'; - node.readable.forkMessage = 'May not be main chain.
Waiting for more confirmations.'; + // if( $scope.chains[node.stats.block.number].score / $scope.maxScore < 0.5) + // { + // node.readable.forkClass = 'text-warning'; + // node.readable.forkMessage = 'May not be main chain.
Waiting for more confirmations.'; - return false; - } - } + // return false; + // } + // } function latencyFilter(node) {