You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

params.h 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright (c) 2009-2010 Satoshi Nakamoto
  2. // Copyright (c) 2009-2015 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. #ifndef BITCOIN_CONSENSUS_PARAMS_H
  6. #define BITCOIN_CONSENSUS_PARAMS_H
  7. #include "uint256.h"
  8. #include <map>
  9. #include <string>
  10. namespace Consensus {
  11. enum DeploymentPos
  12. {
  13. DEPLOYMENT_TESTDUMMY,
  14. DEPLOYMENT_CSV, // Deployment of BIP68, BIP112, and BIP113.
  15. MAX_VERSION_BITS_DEPLOYMENTS
  16. };
  17. /**
  18. * Struct for each individual consensus rule change using BIP9.
  19. */
  20. struct BIP9Deployment {
  21. /** Bit position to select the particular bit in nVersion. */
  22. int bit;
  23. /** Start MedianTime for version bits miner confirmation. Can be a date in the past */
  24. int64_t nStartTime;
  25. /** Timeout/expiry MedianTime for the deployment attempt. */
  26. int64_t nTimeout;
  27. };
  28. /**
  29. * Parameters that influence chain consensus.
  30. */
  31. struct Params {
  32. uint256 hashGenesisBlock;
  33. int nSubsidyHalvingInterval;
  34. /** Used to check majorities for block version upgrade */
  35. int nMajorityEnforceBlockUpgrade;
  36. int nMajorityRejectBlockOutdated;
  37. int nMajorityWindow;
  38. /** Block height and hash at which BIP34 becomes active */
  39. int BIP34Height;
  40. uint256 BIP34Hash;
  41. /**
  42. * Minimum blocks including miner confirmation of the total of 2016 blocks in a retargetting period,
  43. * (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments.
  44. * Examples: 1916 for 95%, 1512 for testchains.
  45. */
  46. uint32_t nRuleChangeActivationThreshold;
  47. uint32_t nMinerConfirmationWindow;
  48. BIP9Deployment vDeployments[MAX_VERSION_BITS_DEPLOYMENTS];
  49. /** Proof of work parameters */
  50. uint256 powLimit;
  51. bool fPowAllowMinDifficultyBlocks;
  52. bool fPowNoRetargeting;
  53. int64_t nPowTargetSpacing;
  54. int64_t nPowTargetTimespan;
  55. int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; }
  56. };
  57. } // namespace Consensus
  58. #endif // BITCOIN_CONSENSUS_PARAMS_H