mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +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:
@@ -841,7 +841,7 @@ static RPCHelpMan getblocktemplate()
|
||||
UniValue vbavailable(UniValue::VOBJ);
|
||||
for (int j = 0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
|
||||
Consensus::DeploymentPos pos = Consensus::DeploymentPos(j);
|
||||
ThresholdState state = VersionBitsState(pindexPrev, consensusParams, pos, g_versionbitscache);
|
||||
ThresholdState state = g_versionbitscache.State(pindexPrev, consensusParams, pos);
|
||||
switch (state) {
|
||||
case ThresholdState::DEFINED:
|
||||
case ThresholdState::FAILED:
|
||||
@@ -849,7 +849,7 @@ static RPCHelpMan getblocktemplate()
|
||||
break;
|
||||
case ThresholdState::LOCKED_IN:
|
||||
// Ensure bit is set in block version
|
||||
pblock->nVersion |= VersionBitsMask(consensusParams, pos);
|
||||
pblock->nVersion |= g_versionbitscache.Mask(consensusParams, pos);
|
||||
// FALL THROUGH to get vbavailable set...
|
||||
case ThresholdState::STARTED:
|
||||
{
|
||||
@@ -858,7 +858,7 @@ static RPCHelpMan getblocktemplate()
|
||||
if (setClientRules.find(vbinfo.name) == setClientRules.end()) {
|
||||
if (!vbinfo.gbt_force) {
|
||||
// If the client doesn't support this, don't indicate it in the [default] version
|
||||
pblock->nVersion &= ~VersionBitsMask(consensusParams, pos);
|
||||
pblock->nVersion &= ~g_versionbitscache.Mask(consensusParams, pos);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user