]> Git Repo - VerusCoin.git/blame - src/chainparams.h
Merge pull request #5997
[VerusCoin.git] / src / chainparams.h
CommitLineData
0e4b3175 1// Copyright (c) 2009-2010 Satoshi Nakamoto
f914f1a7 2// Copyright (c) 2009-2014 The Bitcoin Core developers
f2e03ffa 3// Distributed under the MIT software license, see the accompanying
0e4b3175
MH
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
84738627
PJ
6#ifndef BITCOIN_CHAINPARAMS_H
7#define BITCOIN_CHAINPARAMS_H
0e4b3175 8
84ce18ca 9#include "chainparamsbase.h"
e11712df 10#include "checkpoints.h"
bd006110 11#include "consensus/params.h"
d2270111 12#include "primitives/block.h"
c8c52de3 13#include "protocol.h"
0e4b3175
MH
14
15#include <vector>
16
0e4b3175 17struct CDNSSeedData {
09eb201b
WL
18 std::string name, host;
19 CDNSSeedData(const std::string &strName, const std::string &strHost) : name(strName), host(strHost) {}
0e4b3175
MH
20};
21
22/**
23 * CChainParams defines various tweakable parameters of a given instance of the
24 * Bitcoin system. There are three: the main network on which people trade goods
25 * and services, the public test network which gets reset from time to time and
26 * a regression test mode which is intended for private networks only. It has
27 * minimal difficulty to ensure that blocks can be found instantly.
28 */
29class CChainParams
30{
31public:
0e4b3175
MH
32 enum Base58Type {
33 PUBKEY_ADDRESS,
34 SCRIPT_ADDRESS,
35 SECRET_KEY,
eb2c9990
PW
36 EXT_PUBLIC_KEY,
37 EXT_SECRET_KEY,
0e4b3175
MH
38
39 MAX_BASE58_TYPES
40 };
41
bd006110 42 const Consensus::Params& GetConsensus() const { return consensus; }
eec37136 43 const CMessageHeader::MessageStartChars& MessageStart() const { return pchMessageStart; }
09eb201b 44 const std::vector<unsigned char>& AlertKey() const { return vAlertPubKey; }
0e4b3175 45 int GetDefaultPort() const { return nDefaultPort; }
bd006110
JT
46 int SubsidyHalvingInterval() const { return consensus.nSubsidyHalvingInterval; }
47 int EnforceBlockUpgradeMajority() const { return consensus.nMajorityEnforceBlockUpgrade; }
48 int RejectBlockOutdatedMajority() const { return consensus.nMajorityRejectBlockOutdated; }
49 int ToCheckBlockUpgradeMajority() const { return consensus.nMajorityWindow; }
d754f34e 50
f2e03ffa 51 /** Used if GenerateBitcoins is called with a negative number of threads */
2595b9ac 52 int DefaultMinerThreads() const { return nMinerThreads; }
699fe635 53 const CBlock& GenesisBlock() const { return genesis; }
c8c52de3 54 bool RequireRPCPassword() const { return fRequireRPCPassword; }
f2e03ffa 55 /** Make miner wait to have peers to avoid wasting work */
c8c52de3 56 bool MiningRequiresPeers() const { return fMiningRequiresPeers; }
3fcfbc8a
PW
57 /** Default value for -checkmempool and -checkblockindex argument */
58 bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
f2e03ffa 59 /** Allow mining of a min-difficulty block */
bd006110 60 bool AllowMinDifficultyBlocks() const { return consensus.fPowAllowMinDifficultyBlocks; }
f2e03ffa 61 /** Make standard checks */
c8c52de3 62 bool RequireStandard() const { return fRequireStandard; }
f2e03ffa 63 /** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
c8c52de3 64 bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
f2e03ffa 65 /** In the future use NetworkIDString() for RPC fields */
cc972107 66 bool TestnetToBeDeprecatedFieldRPC() const { return fTestnetToBeDeprecatedFieldRPC; }
f2e03ffa 67 /** Return the BIP70 network string (main, test or regtest) */
f5ae6c98 68 std::string NetworkIDString() const { return strNetworkID; }
09eb201b 69 const std::vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
c8c52de3 70 const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
09eb201b 71 const std::vector<CAddress>& FixedSeeds() const { return vFixedSeeds; }
e11712df 72 virtual const Checkpoints::CCheckpointData& Checkpoints() const = 0;
0e4b3175 73protected:
96b9603c 74 CChainParams() {}
0e4b3175 75
bd006110 76 Consensus::Params consensus;
eec37136 77 CMessageHeader::MessageStartChars pchMessageStart;
f2e03ffa 78 //! Raw pub key bytes for the broadcast alert signing key.
09eb201b 79 std::vector<unsigned char> vAlertPubKey;
0e4b3175 80 int nDefaultPort;
2595b9ac 81 int nMinerThreads;
09eb201b 82 std::vector<CDNSSeedData> vSeeds;
8388289e 83 std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
f5ae6c98 84 std::string strNetworkID;
c8c52de3 85 CBlock genesis;
09eb201b 86 std::vector<CAddress> vFixedSeeds;
c8c52de3 87 bool fRequireRPCPassword;
88 bool fMiningRequiresPeers;
3fcfbc8a 89 bool fDefaultConsistencyChecks;
c8c52de3 90 bool fRequireStandard;
c8c52de3 91 bool fMineBlocksOnDemand;
cc972107 92 bool fTestnetToBeDeprecatedFieldRPC;
0e4b3175
MH
93};
94
95/**
96 * Return the currently selected parameters. This won't change after app startup
97 * outside of the unit tests.
98 */
99const CChainParams &Params();
100
e84843c0
RN
101/** Return parameters for the given network. */
102CChainParams &Params(CBaseChainParams::Network network);
103
0e4b3175 104/** Sets the params returned by Params() to those for the given network. */
84ce18ca 105void SelectParams(CBaseChainParams::Network network);
0e4b3175
MH
106
107/**
108 * Looks for -regtest or -testnet and then calls SelectParams as appropriate.
109 * Returns false if an invalid combination is given.
110 */
111bool SelectParamsFromCommandLine();
112
84738627 113#endif // BITCOIN_CHAINPARAMS_H
This page took 0.134816 seconds and 4 git commands to generate.