diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java index f7e42b32f65..a458e9bd51a 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java @@ -47,7 +47,12 @@ import java.util.concurrent.CompletionStage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + public class FastSyncDownloadPipelineFactory implements DownloadPipelineFactory { + private static final Logger LOG = LoggerFactory.getLogger(FastSyncDownloadPipelineFactory.class); + protected final SynchronizerConfiguration syncConfig; protected final ProtocolSchedule protocolSchedule; protected final ProtocolContext protocolContext; @@ -172,6 +177,18 @@ protected BlockHeader getCommonAncestor(final SyncTarget syncTarget) { protected boolean shouldContinueDownloadingFromPeer( final EthPeer peer, final BlockHeader lastRoundHeader) { final BlockHeader pivotBlockHeader = fastSyncState.getPivotBlockHeader().get(); - return !peer.isDisconnected() && lastRoundHeader.getNumber() < pivotBlockHeader.getNumber(); + final boolean shouldContinue = + !peer.isDisconnected() && lastRoundHeader.getNumber() < pivotBlockHeader.getNumber(); + + if (!shouldContinue && peer.isDisconnected()) { + LOG.debug("Stopping chain download due to disconnected peer {}", peer); + } else if (!shouldContinue && lastRoundHeader.getNumber() >= pivotBlockHeader.getNumber()) { + LOG.debug( + "Stopping chain download as lastRoundHeader={} is not less than pivotBlockHeader={} for peer {}", + lastRoundHeader.getNumber(), + pivotBlockHeader.getNumber(), + peer); + } + return shouldContinue; } }