diff --git a/src/validation.cpp b/src/validation.cpp index 33059cfacd7..fdac89ecbd3 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -4738,10 +4738,19 @@ void ProcessAuthsIfTipChanged(CBlockIndex const * oldTip, CBlockIndex const * ti int anchorHeight = static_cast(pindex->height) - consensus.mn.anchoringFrequency; // Get anchor block from specified time depth - while (anchorHeight > 0 && ::ChainActive()[anchorHeight]->nTime + consensus.mn.anchoringTimeDepth > pindex->nTime) { + int64_t timeDepth = consensus.mn.anchoringTimeDepth; + while (anchorHeight > 0 && ::ChainActive()[anchorHeight]->nTime + timeDepth > pindex->nTime) { --anchorHeight; } + // Select a block further back to avoid Anchor too new error. + if (consensus.FortCanningHeight >= tip->height) { + timeDepth += consensus.mn.anchoringTeamChange * consensus.pos.nTargetSpacing; + while (anchorHeight > 0 && ::ChainActive()[anchorHeight]->nTime + timeDepth > pindex->nTime) { + --anchorHeight; + } + } + // Rollback to height consistent with anchoringFrequency while (anchorHeight > 0 && anchorHeight % consensus.mn.anchoringFrequency != 0) { --anchorHeight;