Repository: dogecoin/dogecoin
File: src/consensus/params.h (C/C++)

Code before:
    bool fPowAllowMinDifficultyBlocks;
    bool fPowNoRetargeting;
    int64_t nPowTargetSpacing;
    int64_t nPowTargetTimespan;
    int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; }
    /** The best chain should have at least this much work */
    uint256 nMinimumChainWork;
    /** By default assume that the signatures in ancestors of this block are valid */
    uint256 defaultAssumeValid;
    /** Minimum interval an assumed valid block must be buried, to be valid. */
    int64_t nAssumeValidMinTime;

    /**
     * If true, witness commitments contain a payload equal to a Bitcoin Script solution
     * to the signet challenge. See BIP325.
     */
    bool signet_blocks{false};
    std::vector<uint8_t> signet_challenge;

    bool fSimplifiedRewards;
    bool fShortEarlyCoinbase;

    /** Auxpow parameters */
    int32_t nAuxpowChainId;
    bool fStrictChainId;
    int nLegacyBlocksBefore; // -1 for "always allow"

    /**
     * Check whether or not to allow legacy blocks at the given height.
     * @param nHeight Height of the block to check.
     * @return True if it is allowed to have a legacy version.
     */
    bool AllowLegacyBlocks(unsigned nHeight) const
    {
        if (nLegacyBlocksBefore < 0)
            return true;
        return static_cast<int> (nHeight) < nLegacyBlocksBefore;
    }
};
} // namespace Consensus

#endif // BITCOIN_CONSENSUS_PARAMS_H


Review comment (suggestion):
The problem I have with this attribute name and logic further down is that "legacy" is very ambiguous: From a 1.8.x point of view, **legacy** blocks are anything that does not have the chainId and version == 2, i.e. must be `version & 0x006200ff  == 0x00620002` or is legacy. However, from a 1.10 perspective, the condition becomes `0x00620003` for a block to not be legacy, and for 1.14, anything that doesn't match `0x00620004` is legacy... so this simply doesn't work well as a reference descriptor.

Additionally, other attributes that specify a height in `Params` are **enabling** a feature whereas this seems to **disable** a feature, but that is not what happened. AuxPoW enabled new blocks, but did not disable things. In fact, 1.8.0 was a hard fork that explicitly enabled a new functionality at that specific height, so this is imho the worst possible place to deviate. 

Code after:
    bool fPowAllowMinDifficultyBlocks;
    bool fPowNoRetargeting;
    int64_t nPowTargetSpacing;
    int64_t nPowTargetTimespan;
    int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; }
    /** The best chain should have at least this much work */
    uint256 nMinimumChainWork;
    /** By default assume that the signatures in ancestors of this block are valid */
    uint256 defaultAssumeValid;
    /** Minimum interval an assumed valid block must be buried, to be valid. */
    int64_t nAssumeValidMinTime;

    /**
     * If true, witness commitments contain a payload equal to a Bitcoin Script solution
     * to the signet challenge. See BIP325.
     */
    bool signet_blocks{false};
    std::vector<uint8_t> signet_challenge;

    bool fSimplifiedRewards;
    bool fShortEarlyCoinbase;

    /** Auxpow parameters */
    int32_t nAuxpowChainId;
    bool fStrictChainId;
    int nAuxPowHeight; // 0 for "always on"
};
} // namespace Consensus

#endif // BITCOIN_CONSENSUS_PARAMS_H