mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
deploymentstatus: make versionbitscache a parameter
This commit is contained in:
parent
78adef1753
commit
d603f1d8a7
1 changed files with 6 additions and 6 deletions
|
@ -14,29 +14,29 @@
|
|||
extern VersionBitsCache g_versionbitscache;
|
||||
|
||||
/** Determine if a deployment is active for the next block */
|
||||
inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::BuriedDeployment dep)
|
||||
inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::BuriedDeployment dep, [[maybe_unused]] VersionBitsCache& versionbitscache = g_versionbitscache)
|
||||
{
|
||||
assert(Consensus::ValidDeployment(dep));
|
||||
return (pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1) >= params.DeploymentHeight(dep);
|
||||
}
|
||||
|
||||
inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos dep)
|
||||
inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos dep, VersionBitsCache& versionbitscache = g_versionbitscache)
|
||||
{
|
||||
assert(Consensus::ValidDeployment(dep));
|
||||
return ThresholdState::ACTIVE == g_versionbitscache.State(pindexPrev, params, dep);
|
||||
return ThresholdState::ACTIVE == versionbitscache.State(pindexPrev, params, dep);
|
||||
}
|
||||
|
||||
/** Determine if a deployment is active for this block */
|
||||
inline bool DeploymentActiveAt(const CBlockIndex& index, const Consensus::Params& params, Consensus::BuriedDeployment dep)
|
||||
inline bool DeploymentActiveAt(const CBlockIndex& index, const Consensus::Params& params, Consensus::BuriedDeployment dep, [[maybe_unused]] VersionBitsCache& versionbitscache = g_versionbitscache)
|
||||
{
|
||||
assert(Consensus::ValidDeployment(dep));
|
||||
return index.nHeight >= params.DeploymentHeight(dep);
|
||||
}
|
||||
|
||||
inline bool DeploymentActiveAt(const CBlockIndex& index, const Consensus::Params& params, Consensus::DeploymentPos dep)
|
||||
inline bool DeploymentActiveAt(const CBlockIndex& index, const Consensus::Params& params, Consensus::DeploymentPos dep, VersionBitsCache& versionbitscache = g_versionbitscache)
|
||||
{
|
||||
assert(Consensus::ValidDeployment(dep));
|
||||
return DeploymentActiveAfter(index.pprev, params, dep);
|
||||
return DeploymentActiveAfter(index.pprev, params, dep, versionbitscache);
|
||||
}
|
||||
|
||||
/** Determine if a deployment is enabled (can ever be active) */
|
||||
|
|
Loading…
Add table
Reference in a new issue