message: [Consensus] Fix old block version check (including v.6)
diff: @@ -4573,23 +4573,11 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
  if (pcheckpoint && nHeight < pcheckpoint->nHeight)
  return state.DoS(0, error("%s : forked chain older than last checkpoint (height %d)", __func__, nHeight));
  - // Reject block.nVersion=1 blocks when 95% (75% on testnet) of the network has upgraded:
  - if (block.nVersion < 2 &&
  - CBlockIndex::IsSuperMajority(2, pindexPrev, Params().RejectBlockOutdatedMajority())) {
  - return state.Invalid(error("%s : rejected nVersion=1 block", __func__),
  - REJECT_OBSOLETE, "bad-version");
  + // Reject block.nVersion=1, ..., CURRENT_VERSION-1 blocks when 95% (75% on testnet) of the network has upgraded:
  + for (int version = 2; version <= CBlockHeader::CURRENT_VERSION; version++) {
  + if (block.nVersion < version && CBlockIndex::IsSuperMajority(version, pindexPrev, Params().RejectBlockOutdatedMajority())) {
  + return state.Invalid(error("%s : rejected nVersion=%d block", __func__, block.nVersion), REJECT_OBSOLETE, "bad-version");
  }
  -
  - // Reject block.nVersion=2 blocks when 95% (75% on testnet) of the network has upgraded:
  - if (block.nVersion < 3 && CBlockIndex::IsSuperMajority(3, pindexPrev, Params().RejectBlockOutdatedMajority())) {
  - return state.Invalid(error("%s : rejected nVersion=2 block", __func__),
  - REJECT_OBSOLETE, "bad-version");
  - }
  -
  - // Reject block.nVersion=4 blocks when 95% (75% on testnet) of the network has upgraded:
  - if (block.nVersion < 5 && CBlockIndex::IsSuperMajority(5, pindexPrev, Params().RejectBlockOutdatedMajority())) {
  - return state.Invalid(error("%s : rejected nVersion=4 block", __func__),
  - REJECT_OBSOLETE, "bad-version");
  }
  return true;
  