Moved version check above getMinBlockchainPeers() check, so that nodes with old versions aren't counted.

This commit is contained in:
CalDescent 2021-05-09 23:00:51 +01:00
parent c4cbb64643
commit af9b536dd9

View File

@ -644,11 +644,15 @@ public class Controller extends Thread {
// Disregard peers that don't have a recent block
peers.removeIf(hasNoRecentBlock);
// Disregard peers that are on an old version
peers.removeIf(hasOldVersion);
checkRecoveryModeForPeers(peers);
if (recoveryMode) {
peers = Network.getInstance().getHandshakedPeers();
peers.removeIf(hasOnlyGenesisBlock);
peers.removeIf(hasMisbehaved);
peers.removeIf(hasOldVersion);
}
// Check we have enough peers to potentially synchronize
@ -661,9 +665,6 @@ public class Controller extends Thread {
// Disregard peers that are on the same block as last sync attempt and we didn't like their chain
peers.removeIf(hasInferiorChainTip);
// Disregard peers that are on an old version
peers.removeIf(hasOldVersion);
final int peersBeforeComparison = peers.size();
// Request recent block summaries from the remaining peers, and locate our common block with each