diff --git a/www/js/services/network-services.js b/www/js/services/network-services.js index 7cdee80e5aa80009b025bf4226e32d5627730068..e38aad0dfab5e25287d585dac660c6cc1dcd202f 100644 --- a/www/js/services/network-services.js +++ b/www/js/services/network-services.js @@ -498,6 +498,7 @@ angular.module('cesium.network.services', ['ngApi', 'cesium.currency.services', // Get current block return peer.api.blockchain.current(false/*no cache*/) .then(function(block) { + if (!block) throw new Error('Wrong response for /blockchain/current (empty)'); peer.currentNumber = block.number; peer.online = true; peer.buid = buid(block); @@ -665,12 +666,16 @@ angular.module('cesium.network.services', ['ngApi', 'cesium.currency.services', if (data.expertMode) { score += (100 * (peer.difficulty ? (10000-peer.difficulty) : 0)); score += (1 * (peer.uid ? computeScoreAlphaValue(peer.uid, 2, true) : 0)); + score += (0.001 * (!peer.uid ? computeScoreAlphaValue(peer.pubkey, 3, true) : 0)); } else { score += (100 * (peer.uid ? computeScoreAlphaValue(peer.uid, 2, true) : 0)); - score += (1 * (!peer.uid ? computeScoreAlphaValue(peer.pubkey, 2, true) : 0)); + score += (0.001 * (!peer.uid ? computeScoreAlphaValue(peer.pubkey, 3, true) : 0)); } - score += (peer.isBma() ? (peer.isSsl() ? 0.01 : 0.001) :0); // If many endpoints: BMAS first, then BMA + score += (0.00001 * (peer.isBma() ? (peer.isSsl() ? 1 : 0.5) :0)); // If many endpoints: BMAS first, then BMA + + peer.score = score; + return -score; }); diff --git a/www/templates/network/items_peers.html b/www/templates/network/items_peers.html index 91d8f10491f32af3eca9aca23e43b8196392011c..4a11311ed51524d71a86ebc2eae2c9f711f61ea9 100644 --- a/www/templates/network/items_peers.html +++ b/www/templates/network/items_peers.html @@ -31,7 +31,7 @@ <div ng-repeat="peer in search.results track by peer.id" class="item item-peer item-icon-left ink {{::ionItemClass}}" ng-class=":rebind:{'compacted': peer.compacted && compactMode}" - id="{{::helptipPrefix}}-peer-{{::$index}}" + ng-attr-id="{{::($index === 0 ? (helptipPrefix + '-peer-0') : undefined)}}" ng-click="selectPeer(peer)" ng-include="::'templates/network/item_content_peer.html'"> </div>