aboutsummaryrefslogtreecommitdiff
path: root/src/chainparams.h
diff options
context:
space:
mode:
authorJorge Timón <jtimon@jtimon.cc>2015-02-11 11:58:11 +0100
committerJorge Timón <jtimon@jtimon.cc>2015-03-25 20:39:26 +0100
commitbd006110fb51f1fc0cbbeef3ed6eaae66b296d8c (patch)
tree303e9ec0bd25fc3c2d15fe33004dcb7459f50b13 /src/chainparams.h
parentcbb2cf5522983e4a952cfb25e577b1998a06c769 (diff)
Consensus: Refactor: Introduce Consensus::Params class
Diffstat (limited to 'src/chainparams.h')
-rw-r--r--src/chainparams.h35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/chainparams.h b/src/chainparams.h
index 134dcd6558..aa2ec1e301 100644
--- a/src/chainparams.h
+++ b/src/chainparams.h
@@ -6,11 +6,12 @@
#ifndef BITCOIN_CHAINPARAMS_H
#define BITCOIN_CHAINPARAMS_H
+#include "arith_uint256.h"
#include "chainparamsbase.h"
#include "checkpoints.h"
+#include "consensus/params.h"
#include "primitives/block.h"
#include "protocol.h"
-#include "arith_uint256.h"
#include <vector>
@@ -39,16 +40,16 @@ public:
MAX_BASE58_TYPES
};
- const uint256& HashGenesisBlock() const { return hashGenesisBlock; }
+ const Consensus::Params& GetConsensus() const { return consensus; }
+ const uint256& HashGenesisBlock() const { return consensus.hashGenesisBlock; }
const CMessageHeader::MessageStartChars& MessageStart() const { return pchMessageStart; }
const std::vector<unsigned char>& AlertKey() const { return vAlertPubKey; }
int GetDefaultPort() const { return nDefaultPort; }
- const arith_uint256& ProofOfWorkLimit() const { return bnProofOfWorkLimit; }
- int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; }
- /** Used to check majorities for block version upgrade */
- int EnforceBlockUpgradeMajority() const { return nEnforceBlockUpgradeMajority; }
- int RejectBlockOutdatedMajority() const { return nRejectBlockOutdatedMajority; }
- int ToCheckBlockUpgradeMajority() const { return nToCheckBlockUpgradeMajority; }
+ const arith_uint256& ProofOfWorkLimit() const { return consensus.powLimit; }
+ int SubsidyHalvingInterval() const { return consensus.nSubsidyHalvingInterval; }
+ int EnforceBlockUpgradeMajority() const { return consensus.nMajorityEnforceBlockUpgrade; }
+ int RejectBlockOutdatedMajority() const { return consensus.nMajorityRejectBlockOutdated; }
+ int ToCheckBlockUpgradeMajority() const { return consensus.nMajorityWindow; }
/** Used if GenerateBitcoins is called with a negative number of threads */
int DefaultMinerThreads() const { return nMinerThreads; }
@@ -59,12 +60,12 @@ public:
/** Default value for -checkmempool argument */
bool DefaultCheckMemPool() const { return fDefaultCheckMemPool; }
/** Allow mining of a min-difficulty block */
- bool AllowMinDifficultyBlocks() const { return fAllowMinDifficultyBlocks; }
+ bool AllowMinDifficultyBlocks() const { return consensus.fPowAllowMinDifficultyBlocks; }
/** Make standard checks */
bool RequireStandard() const { return fRequireStandard; }
- int64_t TargetTimespan() const { return nTargetTimespan; }
- int64_t TargetSpacing() const { return nTargetSpacing; }
- int64_t DifficultyAdjustmentInterval() const { return nTargetTimespan / nTargetSpacing; }
+ int64_t TargetTimespan() const { return consensus.nPowTargetTimespan; }
+ int64_t TargetSpacing() const { return consensus.nPowTargetSpacing; }
+ int64_t DifficultyAdjustmentInterval() const { return consensus.nPowTargetTimespan / consensus.nPowTargetSpacing; }
/** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
/** In the future use NetworkIDString() for RPC fields */
@@ -78,18 +79,11 @@ public:
protected:
CChainParams() {}
- uint256 hashGenesisBlock;
+ Consensus::Params consensus;
CMessageHeader::MessageStartChars pchMessageStart;
//! Raw pub key bytes for the broadcast alert signing key.
std::vector<unsigned char> vAlertPubKey;
int nDefaultPort;
- arith_uint256 bnProofOfWorkLimit;
- int nSubsidyHalvingInterval;
- int nEnforceBlockUpgradeMajority;
- int nRejectBlockOutdatedMajority;
- int nToCheckBlockUpgradeMajority;
- int64_t nTargetTimespan;
- int64_t nTargetSpacing;
int nMinerThreads;
std::vector<CDNSSeedData> vSeeds;
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
@@ -99,7 +93,6 @@ protected:
bool fRequireRPCPassword;
bool fMiningRequiresPeers;
bool fDefaultCheckMemPool;
- bool fAllowMinDifficultyBlocks;
bool fRequireStandard;
bool fMineBlocksOnDemand;
bool fTestnetToBeDeprecatedFieldRPC;