Skip to content

Commit

Permalink
Load blockchain with max score
Browse files Browse the repository at this point in the history
  • Loading branch information
koloale committed Apr 18, 2017
1 parent bcb2a5e commit 071d149
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/scorex/network/BlockchainSynchronizer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
}

Expand Down Expand Up @@ -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))
}

Expand Down

0 comments on commit 071d149

Please sign in to comment.