Coverage Report

Created: 2025-06-10 13:21

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/bitcoin/src/deploymentstatus.h
Line
Count
Source
1
// Copyright (c) 2020-2022 The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_DEPLOYMENTSTATUS_H
6
#define BITCOIN_DEPLOYMENTSTATUS_H
7
8
#include <chain.h>
9
#include <versionbits.h>
10
11
#include <limits>
12
13
/** Determine if a deployment is active for the next block */
14
inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::BuriedDeployment dep, [[maybe_unused]] VersionBitsCache& versionbitscache)
15
8.93M
{
16
8.93M
    assert(Consensus::ValidDeployment(dep));
  Branch (16:5): [True: 8.93M, False: 0]
17
8.93M
    return (pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1) >= params.DeploymentHeight(dep);
  Branch (17:13): [True: 0, False: 8.93M]
18
8.93M
}
19
20
inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos dep, VersionBitsCache& versionbitscache)
21
0
{
22
0
    assert(Consensus::ValidDeployment(dep));
23
0
    return versionbitscache.IsActiveAfter(pindexPrev, params, dep);
24
0
}
25
26
/** Determine if a deployment is active for this block */
27
inline bool DeploymentActiveAt(const CBlockIndex& index, const Consensus::Params& params, Consensus::BuriedDeployment dep, [[maybe_unused]] VersionBitsCache& versionbitscache)
28
15.7M
{
29
15.7M
    assert(Consensus::ValidDeployment(dep));
  Branch (29:5): [True: 15.7M, False: 0]
30
15.7M
    return index.nHeight >= params.DeploymentHeight(dep);
31
15.7M
}
32
33
inline bool DeploymentActiveAt(const CBlockIndex& index, const Consensus::Params& params, Consensus::DeploymentPos dep, VersionBitsCache& versionbitscache)
34
0
{
35
0
    assert(Consensus::ValidDeployment(dep));
36
0
    return DeploymentActiveAfter(index.pprev, params, dep, versionbitscache);
37
0
}
38
39
/** Determine if a deployment is enabled (can ever be active) */
40
inline bool DeploymentEnabled(const Consensus::Params& params, Consensus::BuriedDeployment dep)
41
0
{
42
0
    assert(Consensus::ValidDeployment(dep));
  Branch (42:5): [True: 0, False: 0]
43
0
    return params.DeploymentHeight(dep) != std::numeric_limits<int>::max();
44
0
}
45
46
inline bool DeploymentEnabled(const Consensus::Params& params, Consensus::DeploymentPos dep)
47
0
{
48
0
    assert(Consensus::ValidDeployment(dep));
  Branch (48:5): [True: 0, False: 0]
49
0
    return params.vDeployments[dep].nStartTime != Consensus::BIP9Deployment::NEVER_ACTIVE;
50
0
}
51
52
#endif // BITCOIN_DEPLOYMENTSTATUS_H