-
Notifications
You must be signed in to change notification settings - Fork 1.2k
test: speed up evo activation fixtures #7460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
d76e4b7
0a9eb2d
bcbf35e
a88c701
b57f55f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -450,13 +450,10 @@ TestChain100Setup::TestChain100Setup( | |
| { | ||
| } | ||
|
|
||
| TestChainSetup::TestChainSetup( | ||
| int num_blocks, | ||
| const std::string& chain_name, | ||
| const std::vector<const char*>& extra_args, | ||
| const bool coins_db_in_memory, | ||
| const bool block_tree_db_in_memory) | ||
| : TestingSetup{chain_name, extra_args, coins_db_in_memory, block_tree_db_in_memory} | ||
| TestChainSetup::TestChainSetup(int num_blocks, const std::string& chain_name, | ||
| const std::vector<const char*>& extra_args, const bool coins_db_in_memory, | ||
| const bool block_tree_db_in_memory, const std::optional<uint256>& expected_tip_hash) : | ||
| TestingSetup{chain_name, extra_args, coins_db_in_memory, block_tree_db_in_memory} | ||
| { | ||
| SetMockTime(1598887952); | ||
| constexpr std::array<unsigned char, 32> vchKey = { | ||
|
|
@@ -492,10 +489,42 @@ TestChainSetup::TestChainSetup( | |
| { | ||
| LOCK(::cs_main); | ||
| auto hash = checkpoints.mapCheckpoints.find(num_blocks); | ||
| assert( | ||
| hash != checkpoints.mapCheckpoints.end() && | ||
| m_node.chainman->ActiveChain().Tip()->GetBlockHash() == hash->second); | ||
| const uint256 actual_hash = m_node.chainman->ActiveChain().Tip()->GetBlockHash(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't do new workarounds here; add a new checkpoint the the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in b57f55f. I removed the |
||
| assert(expected_tip_hash.has_value() || hash != checkpoints.mapCheckpoints.end()); | ||
| const uint256& expected_hash = expected_tip_hash.has_value() ? *expected_tip_hash : hash->second; | ||
| assert(actual_hash == expected_hash); | ||
| } | ||
| } | ||
|
|
||
| namespace { | ||
| // This is the lowest activation height that leaves enough mature pre-mined coinbases for all | ||
| // consumers of the shared fixture. The DIP3 prerequisite is active before the v19 boundary work. | ||
| constexpr int V19_ACTIVATION_HEIGHT{109}; | ||
| } // namespace | ||
|
|
||
| TestChainV19BeforeActivationSetup::TestChainV19BeforeActivationSetup() : | ||
| TestChainSetup{V19_ACTIVATION_HEIGHT - 6, | ||
| CBaseChainParams::REGTEST, | ||
| {"-dip3params=100:500", "-testactivationheight=v19@109", "-testactivationheight=v20@109", | ||
| "-testactivationheight=mn_rr@109"}, | ||
| /*coins_db_in_memory=*/true, | ||
| /*block_tree_db_in_memory=*/true, | ||
| uint256S("0x13adad9565d0ca558f5675c50e3828f4354d26b64de044ebc88686056f30faab")} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add this checkpoint to the list of checkpoints ; inside
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in b57f55f. Height 103 is now registered in |
||
| { | ||
| assert(WITH_LOCK(::cs_main, return !DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), m_node.chainman->GetConsensus(), | ||
| Consensus::DEPLOYMENT_V19))); | ||
| } | ||
|
|
||
| TestChainV19Setup::TestChainV19Setup() | ||
| { | ||
| const CScript coinbase_pk = GetScriptForRawPubKey(coinbaseKey.GetPubKey()); | ||
| for (int i = 0; i < 5; ++i) { | ||
| CreateAndProcessBlock({}, coinbase_pk); | ||
| } | ||
| assert(WITH_LOCK(::cs_main, return DeploymentActiveAfter(m_node.chainman->ActiveChain().Tip(), m_node.chainman->GetConsensus(), | ||
| Consensus::DEPLOYMENT_V19) && | ||
| !DeploymentActiveAt(*m_node.chainman->ActiveChain().Tip(), m_node.chainman->GetConsensus(), | ||
| Consensus::DEPLOYMENT_V19))); | ||
| } | ||
|
|
||
| void TestChainSetup::mineBlocks(int num_blocks) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should you clean up any included header after removing this
TestChainV19Setup?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good catch. Removed the now-unused
<chainparams.h>include in b57f55f. The remaining boundary test still directly needs<deploymentstatus.h>and<script/standard.h>.