Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2020-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_DEPLOYMENTSTATUS_H6#define BITCOIN_DEPLOYMENTSTATUS_H8#include <chain.h>9#include <versionbits.h>11#include <limits>13/** Determine if a deployment is active for the next block */14inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::BuriedDeployment dep, [[maybe_unused]] VersionBitsCache& versionbitscache)15{16assert(Consensus::ValidDeployment(dep));17return (pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1) >= params.DeploymentHeight(dep);18}20inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos dep, VersionBitsCache& versionbitscache)21{22assert(Consensus::ValidDeployment(dep));23return versionbitscache.IsActiveAfter(pindexPrev, params, dep);24}26/** Determine if a deployment is active for this block */27inline bool DeploymentActiveAt(const CBlockIndex& index, const Consensus::Params& params, Consensus::BuriedDeployment dep, [[maybe_unused]] VersionBitsCache& versionbitscache)28{29assert(Consensus::ValidDeployment(dep));30return index.nHeight >= params.DeploymentHeight(dep);31}33inline bool DeploymentActiveAt(const CBlockIndex& index, const Consensus::Params& params, Consensus::DeploymentPos dep, VersionBitsCache& versionbitscache)34{35assert(Consensus::ValidDeployment(dep));36return DeploymentActiveAfter(index.pprev, params, dep, versionbitscache);37}39/** Determine if a deployment is enabled (can ever be active) */40inline bool DeploymentEnabled(const Consensus::Params& params, Consensus::BuriedDeployment dep)41{42assert(Consensus::ValidDeployment(dep));43return params.DeploymentHeight(dep) != std::numeric_limits<int>::max();44}46inline bool DeploymentEnabled(const Consensus::Params& params, Consensus::DeploymentPos dep)47{48assert(Consensus::ValidDeployment(dep));49return params.vDeployments[dep].nStartTime != Consensus::BIP9Deployment::NEVER_ACTIVE;50}52#endif // BITCOIN_DEPLOYMENTSTATUS_H
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.