Revert "Filter out peers of divergent or significantly inferior chains when syncing."

This reverts commit 1dc7f056f9cb9b08fb44ae50896844cfcd144ead. To be un-reverted in future when there is more time available for testing.
This commit is contained in:
CalDescent 2022-12-22 15:10:19 +00:00
parent 2a4ac1ed24
commit 0e81665a36
2 changed files with 0 additions and 16 deletions

View File

@ -752,19 +752,6 @@ public class Controller extends Thread {
return peerChainTipData == null || peerChainTipData.getSignature() == null || inferiorChainTips.contains(ByteArray.wrap(peerChainTipData.getSignature()));
};
/**
* If a peer has a recent block timestamp, but its height is more than 25 blocks behind ours,
* we can assume it has a significantly inferior chain, and is most likely too divergent.
* Early filtering of these peers prevents a lot of very expensive chain weight comparisons.
*/
public static final Predicate<Peer> hasInferiorChain = peer -> {
final Long minLatestBlockTimestamp = getMinimumLatestBlockTimestamp();
final int ourHeight = Controller.getInstance().getChainHeight();
final BlockSummaryData peerChainTipData = peer.getChainTipData();
boolean peerUpToDate = peerChainTipData != null && peerChainTipData.getTimestamp() != null && peerChainTipData.getTimestamp() >= minLatestBlockTimestamp;
return peerUpToDate && ourHeight - peerChainTipData.getHeight() > 25;
};
public static final Predicate<Peer> hasOldVersion = peer -> {
final String minPeerVersion = Settings.getInstance().getMinPeerVersion();
return peer.isAtLeastVersion(minPeerVersion) == false;

View File

@ -247,9 +247,6 @@ public class Synchronizer extends Thread {
// Disregard peers that are on the same block as last sync attempt and we didn't like their chain
peers.removeIf(Controller.hasInferiorChainTip);
// Disregard peers that are on a very inferior chain, based on their heights and timestamps
peers.removeIf(Controller.hasInferiorChain);
// Disregard peers that have a block with an invalid signer
peers.removeIf(Controller.hasInvalidSigner);