]> Git Repo - VerusCoin.git/blob - src/chainparams.h
Test
[VerusCoin.git] / src / chainparams.h
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2014 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_CHAINPARAMS_H
7 #define BITCOIN_CHAINPARAMS_H
8
9 #include "chainparamsbase.h"
10 #include "checkpoints.h"
11 #include "consensus/params.h"
12 #include "primitives/block.h"
13 #include "protocol.h"
14
15 #define KOMODO_MINDIFF_NBITS 0x200f0f0f
16
17 #include <vector>
18
19 struct CDNSSeedData {
20     std::string name, host;
21     CDNSSeedData(const std::string &strName, const std::string &strHost) : name(strName), host(strHost) {}
22 };
23
24 struct SeedSpec6 {
25     uint8_t addr[16];
26     uint16_t port;
27 };
28
29
30 /**
31  * CChainParams defines various tweakable parameters of a given instance of the
32  * Bitcoin system. There are three: the main network on which people trade goods
33  * and services, the public test network which gets reset from time to time and
34  * a regression test mode which is intended for private networks only. It has
35  * minimal difficulty to ensure that blocks can be found instantly.
36  */
37 class CChainParams
38 {
39 public:
40     enum Base58Type {
41         PUBKEY_ADDRESS,
42         SCRIPT_ADDRESS,
43         SECRET_KEY,
44         EXT_PUBLIC_KEY,
45         EXT_SECRET_KEY,
46
47         ZCPAYMENT_ADDRRESS,
48         ZCSPENDING_KEY,
49
50         MAX_BASE58_TYPES
51     };
52
53     const Consensus::Params& GetConsensus() const { return consensus; }
54     const CMessageHeader::MessageStartChars& MessageStart() const { return pchMessageStart; }
55     const std::vector<unsigned char>& AlertKey() const { return vAlertPubKey; }
56     int GetDefaultPort() const { return nDefaultPort; }
57
58     /** Used if GenerateBitcoins is called with a negative number of threads */
59     int DefaultMinerThreads() const { return nMinerThreads; }
60     const CBlock& GenesisBlock() const { return genesis; }
61     bool RequireRPCPassword() const { return fRequireRPCPassword; }
62     /** Make miner wait to have peers to avoid wasting work */
63     bool MiningRequiresPeers() const { return fMiningRequiresPeers; }
64     /** Default value for -checkmempool and -checkblockindex argument */
65     bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }
66     /** Policy: Filter transactions that do not match well-defined patterns */
67     bool RequireStandard() const { return fRequireStandard; }
68     int64_t MaxTipAge() const { return nMaxTipAge; }
69     int64_t PruneAfterHeight() const { return nPruneAfterHeight; }
70     unsigned int EquihashN() const { return nEquihashN; }
71     unsigned int EquihashK() const { return nEquihashK; }
72     std::string CurrencyUnits() const { return strCurrencyUnits; }
73     /** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
74     bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
75     /** In the future use NetworkIDString() for RPC fields */
76     bool TestnetToBeDeprecatedFieldRPC() const { return fTestnetToBeDeprecatedFieldRPC; }
77     /** Return the BIP70 network string (main, test or regtest) */
78     std::string NetworkIDString() const { return strNetworkID; }
79     const std::vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
80     const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
81     const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
82     const Checkpoints::CCheckpointData& Checkpoints() const { return checkpointData; }
83     /** Return the founder's reward address and script for a given block height */
84     std::string GetFoundersRewardAddressAtHeight(int height) const;
85     CScript GetFoundersRewardScriptAtHeight(int height) const;
86     std::string GetFoundersRewardAddressAtIndex(int i) const;
87     /** Enforce coinbase consensus rule in regtest mode */
88     void SetRegTestCoinbaseMustBeProtected() { consensus.fCoinbaseMustBeProtected = true; }
89
90     void SetDefaultPort(uint16_t port) { nDefaultPort = port; }
91     //void setnonce(uint32_t nonce) { memcpy(&genesis.nNonce,&nonce,sizeof(nonce)); }
92     //void settimestamp(uint32_t timestamp) { genesis.nTime = timestamp; }
93     //void setgenesis(CBlock &block) { genesis = block; }
94     //void recalc_genesis(uint32_t nonce) { genesis = CreateGenesisBlock(ASSETCHAINS_TIMESTAMP, nonce, GENESIS_NBITS, 1, COIN); };
95     int nDefaultPort = 0;
96     CMessageHeader::MessageStartChars pchMessageStart; // jl777 moved
97 protected:
98     CChainParams() {}
99     Consensus::Params consensus; 
100
101      //! Raw pub key bytes for the broadcast alert signing key.
102     std::vector<unsigned char> vAlertPubKey;
103     int nMinerThreads = 0;
104     long nMaxTipAge = 0;
105     uint64_t nPruneAfterHeight = 0;
106     unsigned int nEquihashN = 0;
107     unsigned int nEquihashK = 0;
108     std::vector<CDNSSeedData> vSeeds;
109     std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
110     std::string strNetworkID;
111     std::string strCurrencyUnits;
112     CBlock genesis;
113     std::vector<SeedSpec6> vFixedSeeds;
114     bool fRequireRPCPassword = false;
115     bool fMiningRequiresPeers = false;
116     bool fDefaultConsistencyChecks = false;
117     bool fRequireStandard = false;
118     bool fMineBlocksOnDemand = false;
119     bool fTestnetToBeDeprecatedFieldRPC = false;
120     Checkpoints::CCheckpointData checkpointData;
121     std::vector<std::string> vFoundersRewardAddress;
122 };
123
124 /**
125  * Return the currently selected parameters. This won't change after app
126  * startup, except for unit tests.
127  */
128 const CChainParams &Params();
129
130 /** Return parameters for the given network. */
131 CChainParams &Params(CBaseChainParams::Network network);
132
133 /** Sets the params returned by Params() to those for the given network. */
134 void SelectParams(CBaseChainParams::Network network);
135
136 /**
137  * Looks for -regtest or -testnet and then calls SelectParams as appropriate.
138  * Returns false if an invalid combination is given.
139  */
140 bool SelectParamsFromCommandLine();
141
142 #endif // BITCOIN_CHAINPARAMS_H
This page took 0.02936 seconds and 4 git commands to generate.