Use nil suggestedLowHash if selected parent pruning point is not in the future of the current one

This commit is contained in:
Ori Newman
2022-03-12 13:54:07 +02:00
parent 433af5e0fe
commit cfc9d5aaa9

View File

@@ -1009,7 +1009,15 @@ func (pm *pruningManager) ExpectedHeaderPruningPoint(stagingArea *model.StagingA
}
if hasReachabilityData {
suggestedLowHash = selectedParentHeader.PruningPoint()
// nextPruningPointAndCandidateByBlockHash needs suggestedLowHash to be in the future of the pruning point because
// otherwise reachability selected chain data is unreliable.
isInFutureOfCurrentPruningPoint, err := pm.dagTopologyManager.IsAncestorOf(stagingArea, pruningPoint, selectedParentHeader.PruningPoint())
if err != nil {
return nil, err
}
if isInFutureOfCurrentPruningPoint {
suggestedLowHash = selectedParentHeader.PruningPoint()
}
}
nextOrCurrentPruningPoint, _, err = pm.nextPruningPointAndCandidateByBlockHash(stagingArea, blockHash, suggestedLowHash)