From c46e052b29f427dd2aee41d5c68a8a2dc9b9a277 Mon Sep 17 00:00:00 2001 From: Ori Newman Date: Tue, 29 Nov 2022 15:23:59 +0200 Subject: [PATCH] Only log error and add comment --- app/protocol/flows/v5/blockrelay/ibd.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/protocol/flows/v5/blockrelay/ibd.go b/app/protocol/flows/v5/blockrelay/ibd.go index a46fc6114..ea0bc4ab9 100644 --- a/app/protocol/flows/v5/blockrelay/ibd.go +++ b/app/protocol/flows/v5/blockrelay/ibd.go @@ -192,12 +192,17 @@ func (flow *handleIBDFlow) negotiateMissingSyncerChainSegment() (*externalapi.Do return nil, nil, protocolerrors.Errorf(true, "Sent invalid chain block %s", syncerChainHash) } - isInSelectedParentChainOfPruningPoint, err := flow.Domain().Consensus().IsInSelectedParentChainOf(pruningPoint, syncerChainHash) + isPruningPointOnSyncerChain, err := flow.Domain().Consensus().IsInSelectedParentChainOf(pruningPoint, syncerChainHash) if err != nil { - return nil, nil, err + log.Errorf("Error checking isPruningPointOnSyncerChain: %s", err) } - if isInSelectedParentChainOfPruningPoint { + // We're only interested in syncer chain blocks that have our pruning + // point in their selected chain. Otherwise, it means one of the following: + // 1) We cannot merge their selected tip without violating the merge depth rule. + // 2) syncerChainHash is actually in the past of our pruning point so there's no + // point in syncing from it. + if err == nil && isPruningPointOnSyncerChain { currentHighestKnownSyncerChainHash = syncerChainHash break }