Fix IBD sync conditions

This commit is contained in:
Ori Newman 2022-11-29 10:53:42 +02:00
parent d4a27bf1c1
commit 9bb19705a4
2 changed files with 11 additions and 2 deletions

View File

@ -285,7 +285,11 @@ func (flow *handleIBDFlow) isGenesisVirtualSelectedParent() (bool, error) {
func (flow *handleIBDFlow) logIBDFinished(isFinishedSuccessfully bool, err error) { func (flow *handleIBDFlow) logIBDFinished(isFinishedSuccessfully bool, err error) {
successString := "successfully" successString := "successfully"
if !isFinishedSuccessfully { if !isFinishedSuccessfully {
if err != nil {
successString = fmt.Sprintf("(interrupted: %s)", err) successString = fmt.Sprintf("(interrupted: %s)", err)
} else {
successString = fmt.Sprintf("(interrupted)", err)
}
} }
log.Infof("IBD with peer %s finished %s", flow.peer, successString) log.Infof("IBD with peer %s finished %s", flow.peer, successString)
} }

View File

@ -85,12 +85,17 @@ func (flow *handleIBDFlow) shouldSyncAndShouldDownloadHeadersProof(
return true, true, nil return true, true, nil
} }
if !highestKnownSyncerChainHash {
log.Infof("Stopping IBD since IBD from this node will cause a finality conflict")
return false, false, nil return false, false, nil
} }
return false, true, nil return false, true, nil
} }
return false, true, nil
}
func (flow *handleIBDFlow) checkIfHighHashHasMoreBlueWorkThanSelectedTipAndPruningDepthMoreBlueScore(relayBlock *externalapi.DomainBlock) (bool, error) { func (flow *handleIBDFlow) checkIfHighHashHasMoreBlueWorkThanSelectedTipAndPruningDepthMoreBlueScore(relayBlock *externalapi.DomainBlock) (bool, error) {
virtualSelectedParent, err := flow.Domain().Consensus().GetVirtualSelectedParent() virtualSelectedParent, err := flow.Domain().Consensus().GetVirtualSelectedParent()
if err != nil { if err != nil {