feat: Allow mining blocks of a specific version on non-mainnet networks (#5433)

## Issue being fixed or feature implemented
Mining blocks with a specific version can be useful on testnet and
devnets too

## What was done?
lift restrictions for `-blockversion`

## How Has This Been Tested?
it should just work :)

## Breaking Changes
n//a

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added or updated relevant unit/integration/functional/e2e
tests
- [ ] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
This commit is contained in:
UdjinM6 2023-06-19 22:04:48 +03:00
parent 549e347b74
commit 1baf2d5933
No known key found for this signature in database
GPG Key ID: 83592BD1400D58D9

View File

@ -135,9 +135,9 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
bool fDIP0008Active_context = nHeight >= chainparams.GetConsensus().DIP0008Height; bool fDIP0008Active_context = nHeight >= chainparams.GetConsensus().DIP0008Height;
pblock->nVersion = ComputeBlockVersion(pindexPrev, chainparams.GetConsensus(), chainparams.BIP9CheckMasternodesUpgraded()); pblock->nVersion = ComputeBlockVersion(pindexPrev, chainparams.GetConsensus(), chainparams.BIP9CheckMasternodesUpgraded());
// -regtest only: allow overriding block.nVersion with // Non-mainnet only: allow overriding block.nVersion with
// -blockversion=N to test forking scenarios // -blockversion=N to test forking scenarios
if (chainparams.MineBlocksOnDemand()) if (Params().NetworkIDString() != CBaseChainParams::MAIN)
pblock->nVersion = gArgs.GetArg("-blockversion", pblock->nVersion); pblock->nVersion = gArgs.GetArg("-blockversion", pblock->nVersion);
pblock->nTime = GetAdjustedTime(); pblock->nTime = GetAdjustedTime();