message: Set max size for fork that will not be validated to 500 blocks before the Tip.
  The max possible fork that can be valid is 500 blocks.
  Headers from longer forks are forced to be validated, they will not pass the checks later, and the nodes will be banned.
diff: @@ -4402,10 +4402,29 @@ bool CChainState::UpdateHashProof(const CBlock& block, CValidationState& state,
  bool CheckPOS(const CBlockHeader& block, CBlockIndex* pindexPrev)
  {
  // Determining if PoS is possible to be checked in the header
  - return pindexPrev && block.IsProofOfStake() && !IsInitialBlockDownload()
  + int diff = pindexPrev->nHeight + 1 - chainActive.Height();
  + if(pindexPrev && block.IsProofOfStake() && !IsInitialBlockDownload()
  // Additional check if not triggered initial block download, like when PoW blocks were initially created
  // CheckPOS is called after ContextualCheckBlockHeader where future block headers are not accepted
  - && (pindexPrev->nHeight + 1 - chainActive.Height() < COINBASE_MATURITY);
  + && (diff < COINBASE_MATURITY))
  + {
  + // Old header not child of the Tip
  + if(diff < -COINBASE_MATURITY)
  + return true;
  +
  + // New header
  + // Determining if the header is child of the Tip
  + CBlockIndex* prev = pindexPrev;
  + for(int i = 0; i < COINBASE_MATURITY; i++)
  + {
  + if(prev == chainActive.Tip())
  + return true;
  + prev = prev->pprev;
  + }
  + }
  +
  + // PoS header proofs are not validated
  + return false;
  }
  bool CChainState::AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex)
  