mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
[refactor] versionbits: make VersionBitsCache a full class
Moves the VersionBits* functions to be methods of the cache class, and makes the cache and its lock private to the class.
This commit is contained in:
@@ -288,7 +288,7 @@ static void check_computeblockversion(const Consensus::Params& params, Consensus
|
||||
// Check min_activation_height is on a retarget boundary
|
||||
BOOST_REQUIRE_EQUAL(min_activation_height % params.nMinerConfirmationWindow, 0U);
|
||||
|
||||
const uint32_t bitmask{VersionBitsMask(params, dep)};
|
||||
const uint32_t bitmask{g_versionbitscache.Mask(params, dep)};
|
||||
BOOST_CHECK_EQUAL(bitmask, uint32_t{1} << bit);
|
||||
|
||||
// In the first chain, test that the bit is set by CBV until it has failed.
|
||||
@@ -426,7 +426,7 @@ BOOST_AUTO_TEST_CASE(versionbits_computeblockversion)
|
||||
// not take precedence over STARTED/LOCKED_IN. So all softforks on
|
||||
// the same bit might overlap, even when non-overlapping start-end
|
||||
// times are picked.
|
||||
const uint32_t dep_mask{VersionBitsMask(chainParams->GetConsensus(), dep)};
|
||||
const uint32_t dep_mask{g_versionbitscache.Mask(chainParams->GetConsensus(), dep)};
|
||||
BOOST_CHECK(!(chain_all_vbits & dep_mask));
|
||||
chain_all_vbits |= dep_mask;
|
||||
check_computeblockversion(chainParams->GetConsensus(), dep);
|
||||
|
||||
Reference in New Issue
Block a user