LCOV - code coverage report
Current view: top level - src - deploymentstatus.h (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 13 24 54.2 %
Date: 2022-04-21 14:51:19 Functions: 4 6 66.7 %
Legend: Modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed

Not modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed
Branches: 2 2 100.0 %

           Branch data     Line data    Source code
#       1                 :            : // Copyright (c) 2020-2021 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                 :            : /** Global cache for versionbits deployment status */
#      14                 :            : extern VersionBitsCache g_versionbitscache;
#      15                 :            : 
#      16                 :            : /** Determine if a deployment is active for the next block */
#      17                 :            : inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::BuriedDeployment dep)
#      18                 :     318283 : {
#      19                 :     318283 :     assert(Consensus::ValidDeployment(dep));
#      20         [ +  + ]:     318283 :     return (pindexPrev == nullptr ? 0 : pindexPrev->nHeight + 1) >= params.DeploymentHeight(dep);
#      21                 :     318283 : }
#      22                 :            : 
#      23                 :            : inline bool DeploymentActiveAfter(const CBlockIndex* pindexPrev, const Consensus::Params& params, Consensus::DeploymentPos dep)
#      24                 :          0 : {
#      25                 :          0 :     assert(Consensus::ValidDeployment(dep));
#      26                 :          0 :     return ThresholdState::ACTIVE == g_versionbitscache.State(pindexPrev, params, dep);
#      27                 :          0 : }
#      28                 :            : 
#      29                 :            : /** Determine if a deployment is active for this block */
#      30                 :            : inline bool DeploymentActiveAt(const CBlockIndex& index, const Consensus::Params& params, Consensus::BuriedDeployment dep)
#      31                 :     799421 : {
#      32                 :     799421 :     assert(Consensus::ValidDeployment(dep));
#      33                 :          0 :     return index.nHeight >= params.DeploymentHeight(dep);
#      34                 :     799421 : }
#      35                 :            : 
#      36                 :            : inline bool DeploymentActiveAt(const CBlockIndex& index, const Consensus::Params& params, Consensus::DeploymentPos dep)
#      37                 :          0 : {
#      38                 :          0 :     assert(Consensus::ValidDeployment(dep));
#      39                 :          0 :     return DeploymentActiveAfter(index.pprev, params, dep);
#      40                 :          0 : }
#      41                 :            : 
#      42                 :            : /** Determine if a deployment is enabled (can ever be active) */
#      43                 :            : inline bool DeploymentEnabled(const Consensus::Params& params, Consensus::BuriedDeployment dep)
#      44                 :        430 : {
#      45                 :        430 :     assert(Consensus::ValidDeployment(dep));
#      46                 :          0 :     return params.DeploymentHeight(dep) != std::numeric_limits<int>::max();
#      47                 :        430 : }
#      48                 :            : 
#      49                 :            : inline bool DeploymentEnabled(const Consensus::Params& params, Consensus::DeploymentPos dep)
#      50                 :        172 : {
#      51                 :        172 :     assert(Consensus::ValidDeployment(dep));
#      52                 :          0 :     return params.vDeployments[dep].nStartTime != Consensus::BIP9Deployment::NEVER_ACTIVE;
#      53                 :        172 : }
#      54                 :            : 
#      55                 :            : #endif // BITCOIN_DEPLOYMENTSTATUS_H

Generated by: LCOV version 0-eol-96201-ge66f56f4af6a