feat: activate DIP0020 on regtest from block 1

This commit is contained in:
Konstantin Akimov 2024-08-08 17:19:29 +07:00
parent d1676b0280
commit cfd7ea2bc3
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524
4 changed files with 10 additions and 4 deletions

View File

@ -806,7 +806,7 @@ public:
consensus.DIP0003EnforcementHash = uint256(); consensus.DIP0003EnforcementHash = uint256();
consensus.DIP0008Height = 432; consensus.DIP0008Height = 432;
consensus.BRRHeight = 1000; // see block_reward_reallocation_tests consensus.BRRHeight = 1000; // see block_reward_reallocation_tests
consensus.DIP0020Height = 300; consensus.DIP0020Height = 1;
consensus.DIP0024Height = 900; consensus.DIP0024Height = 900;
consensus.DIP0024QuorumsHeight = 900; consensus.DIP0024QuorumsHeight = 900;
consensus.V19Height = 900; consensus.V19Height = 900;
@ -1054,6 +1054,8 @@ static void MaybeUpdateHeights(const ArgsManager& args, Consensus::Params& conse
consensus.BIP65Height = int{height}; consensus.BIP65Height = int{height};
} else if (name == "csv") { } else if (name == "csv") {
consensus.CSVHeight = int{height}; consensus.CSVHeight = int{height};
} else if (name == "dip0020") {
consensus.DIP0020Height = int{height};
} else { } else {
throw std::runtime_error(strprintf("Invalid name (%s) for -testactivationheight=name@height.", arg)); throw std::runtime_error(strprintf("Invalid name (%s) for -testactivationheight=name@height.", arg));
} }

View File

@ -22,7 +22,7 @@ void SetupChainParamsBaseOptions(ArgsManager& argsman)
argsman.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-dip8params=<activation>", "Override DIP8 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-dip8params=<activation>", "Override DIP8 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-bip147height=<activation>", "Override BIP147 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-bip147height=<activation>", "Override BIP147 activation height (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST); argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (bip147, bip34, dersig, cltv, csv, dip0020). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-highsubsidyblocks=<n>", "The number of blocks with a higher than normal subsidy to mine at the start of a chain. Block after that height will have fixed subsidy base. (default: 0, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-highsubsidyblocks=<n>", "The number of blocks with a higher than normal subsidy to mine at the start of a chain. Block after that height will have fixed subsidy base. (default: 0, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-highsubsidyfactor=<n>", "The factor to multiply the normal block subsidy by while in the highsubsidyblocks window of a chain (default: 1, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-highsubsidyfactor=<n>", "The factor to multiply the normal block subsidy by while in the highsubsidyblocks window of a chain (default: 1, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-llmqchainlocks=<quorum name>", "Override the default LLMQ type used for ChainLocks. Allows using ChainLocks with smaller LLMQs. (default: llmq_devnet, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS); argsman.AddArg("-llmqchainlocks=<quorum name>", "Override the default LLMQ type used for ChainLocks. Allows using ChainLocks with smaller LLMQs. (default: llmq_devnet, devnet-only)", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);

View File

@ -16,10 +16,14 @@ This test checks activation of DIP0020 opcodes
DISABLED_OPCODE_ERROR = "non-mandatory-script-verify-flag (Attempted to use a disabled opcode)" DISABLED_OPCODE_ERROR = "non-mandatory-script-verify-flag (Attempted to use a disabled opcode)"
DIP0020_HEIGHT = 300
class DIP0020ActivationTest(BitcoinTestFramework): class DIP0020ActivationTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.num_nodes = 1 self.num_nodes = 1
self.extra_args = [["-acceptnonstdtxn=1"]] self.extra_args = [[
f'-testactivationheight=dip0020@{DIP0020_HEIGHT}',
"-acceptnonstdtxn=1",
]]
def skip_test_if_missing_module(self): def skip_test_if_missing_module(self):
self.skip_if_no_wallet() self.skip_if_no_wallet()

View File

@ -150,7 +150,7 @@ class BlockchainTest(BitcoinTestFramework):
'dip0001': { 'type': 'buried', 'active': False, 'height': 2000}, 'dip0001': { 'type': 'buried', 'active': False, 'height': 2000},
'dip0003': { 'type': 'buried', 'active': False, 'height': 432}, 'dip0003': { 'type': 'buried', 'active': False, 'height': 432},
'dip0008': { 'type': 'buried', 'active': False, 'height': 432}, 'dip0008': { 'type': 'buried', 'active': False, 'height': 432},
'dip0020': { 'type': 'buried', 'active': False, 'height': 300}, 'dip0020': { 'type': 'buried', 'active': True, 'height': 1},
'dip0024': { 'type': 'buried', 'active': False, 'height': 900}, 'dip0024': { 'type': 'buried', 'active': False, 'height': 900},
'realloc': { 'type': 'buried', 'active': False, 'height': 1000}, 'realloc': { 'type': 'buried', 'active': False, 'height': 1000},
'v19': { 'type': 'buried', 'active': False, 'height': 900}, 'v19': { 'type': 'buried', 'active': False, 'height': 900},