LCOV - code coverage report
Current view: top level - src/consensus - params.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 2 2 100.0 %
Date: 2020-09-26 01:30:44 Functions: 3 3 100.0 %

          Line data    Source code
       1             : // Copyright (c) 2009-2010 Satoshi Nakamoto
       2             : // Copyright (c) 2009-2019 The Bitcoin Core developers
       3             : // Distributed under the MIT software license, see the accompanying
       4             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       5             : 
       6             : #ifndef BITCOIN_CONSENSUS_PARAMS_H
       7             : #define BITCOIN_CONSENSUS_PARAMS_H
       8             : 
       9             : #include <uint256.h>
      10             : #include <limits>
      11             : 
      12             : namespace Consensus {
      13             : 
      14             : enum DeploymentPos
      15             : {
      16             :     DEPLOYMENT_TESTDUMMY,
      17             :     // NOTE: Also add new deployments to VersionBitsDeploymentInfo in versionbits.cpp
      18             :     MAX_VERSION_BITS_DEPLOYMENTS
      19             : };
      20             : 
      21             : /**
      22             :  * Struct for each individual consensus rule change using BIP9.
      23             :  */
      24             : struct BIP9Deployment {
      25             :     /** Bit position to select the particular bit in nVersion. */
      26             :     int bit;
      27             :     /** Start MedianTime for version bits miner confirmation. Can be a date in the past */
      28             :     int64_t nStartTime;
      29             :     /** Timeout/expiry MedianTime for the deployment attempt. */
      30             :     int64_t nTimeout;
      31             : 
      32             :     /** Constant for nTimeout very far in the future. */
      33             :     static constexpr int64_t NO_TIMEOUT = std::numeric_limits<int64_t>::max();
      34             : 
      35             :     /** Special value for nStartTime indicating that the deployment is always active.
      36             :      *  This is useful for testing, as it means tests don't need to deal with the activation
      37             :      *  process (which takes at least 3 BIP9 intervals). Only tests that specifically test the
      38             :      *  behaviour during activation cannot use this. */
      39             :     static constexpr int64_t ALWAYS_ACTIVE = -1;
      40             : };
      41             : 
      42             : /**
      43             :  * Parameters that influence chain consensus.
      44             :  */
      45        9060 : struct Params {
      46             :     uint256 hashGenesisBlock;
      47             :     int nSubsidyHalvingInterval;
      48             :     /* Block hash that is excepted from BIP16 enforcement */
      49             :     uint256 BIP16Exception;
      50             :     /** Block height and hash at which BIP34 becomes active */
      51             :     int BIP34Height;
      52             :     uint256 BIP34Hash;
      53             :     /** Block height at which BIP65 becomes active */
      54             :     int BIP65Height;
      55             :     /** Block height at which BIP66 becomes active */
      56             :     int BIP66Height;
      57             :     /** Block height at which CSV (BIP68, BIP112 and BIP113) becomes active */
      58             :     int CSVHeight;
      59             :     /** Block height at which Segwit (BIP141, BIP143 and BIP147) becomes active.
      60             :      * Note that segwit v0 script rules are enforced on all blocks except the
      61             :      * BIP 16 exception blocks. */
      62             :     int SegwitHeight;
      63             :     /** Don't warn about unknown BIP 9 activations below this height.
      64             :      * This prevents us from warning about the CSV and segwit activations. */
      65             :     int MinBIP9WarningHeight;
      66             :     /**
      67             :      * Minimum blocks including miner confirmation of the total of 2016 blocks in a retargeting period,
      68             :      * (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments.
      69             :      * Examples: 1916 for 95%, 1512 for testchains.
      70             :      */
      71             :     uint32_t nRuleChangeActivationThreshold;
      72             :     uint32_t nMinerConfirmationWindow;
      73             :     BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS];
      74             :     /** Proof of work parameters */
      75             :     uint256 powLimit;
      76             :     bool fPowAllowMinDifficultyBlocks;
      77             :     bool fPowNoRetargeting;
      78             :     int64_t nPowTargetSpacing;
      79             :     int64_t nPowTargetTimespan;
      80    33101509 :     int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; }
      81             :     uint256 nMinimumChainWork;
      82             :     uint256 defaultAssumeValid;
      83             : };
      84             : } // namespace Consensus
      85             : 
      86             : #endif // BITCOIN_CONSENSUS_PARAMS_H

Generated by: LCOV version 1.15