From 071d1497674a9b4deb4db17582f4d85635ecd0aa Mon Sep 17 00:00:00 2001 From: Alexey Koloskov Date: Tue, 18 Apr 2017 17:49:13 +0300 Subject: [PATCH] Load blockchain with max score --- src/main/scala/scorex/network/BlockchainSynchronizer.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/scorex/network/BlockchainSynchronizer.scala b/src/main/scala/scorex/network/BlockchainSynchronizer.scala index 42849c8b68b..137fba11045 100755 --- a/src/main/scala/scorex/network/BlockchainSynchronizer.scala +++ b/src/main/scala/scorex/network/BlockchainSynchronizer.scala @@ -55,7 +55,7 @@ class BlockchainSynchronizer(application: Application) extends ViewSynchronizer networkControllerRef ! NetworkController.SendToNetwork(msg, SendToChosen(maxPeers.keys.toSeq)) - gettingExtension(lastIds.map(InnerId), maxPeers.map(peer => peer._1 -> Peer(peer._2))) + gettingExtension(lastIds.map(InnerId), peerScores.map(peer => peer._1 -> Peer(peer._2))) } } @@ -241,7 +241,7 @@ class BlockchainSynchronizer(application: Application) extends ViewSynchronizer val sortedByScore = updatedPeers.toSeq.sortBy(_._2.score).map(_._1) sortedByScore.filterNot(_ == active).lastOption - .orElse(sortedByScore.headOption) + .orElse(sortedByScore.lastOption) .map(newActive => ps.copy(active = newActive, peers = updatedPeers)) }