Remove CValidationInterface::UpdatedTransaction
[bitcoinplatinum.git] / src / chainparams.h
blob4fe88c691cf89c3df1acd6a4998348e7db197196
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 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.
6 #ifndef BITCOIN_CHAINPARAMS_H
7 #define BITCOIN_CHAINPARAMS_H
9 #include "chainparamsbase.h"
10 #include "consensus/params.h"
11 #include "primitives/block.h"
12 #include "protocol.h"
14 #include <vector>
16 struct CDNSSeedData {
17 std::string name, host;
18 bool supportsServiceBitsFiltering;
19 CDNSSeedData(const std::string &strName, const std::string &strHost, bool supportsServiceBitsFilteringIn = false) : name(strName), host(strHost), supportsServiceBitsFiltering(supportsServiceBitsFilteringIn) {}
22 struct SeedSpec6 {
23 uint8_t addr[16];
24 uint16_t port;
27 typedef std::map<int, uint256> MapCheckpoints;
29 struct CCheckpointData {
30 MapCheckpoints mapCheckpoints;
33 struct ChainTxData {
34 int64_t nTime;
35 int64_t nTxCount;
36 double dTxRate;
39 /**
40 * CChainParams defines various tweakable parameters of a given instance of the
41 * Bitcoin system. There are three: the main network on which people trade goods
42 * and services, the public test network which gets reset from time to time and
43 * a regression test mode which is intended for private networks only. It has
44 * minimal difficulty to ensure that blocks can be found instantly.
46 class CChainParams
48 public:
49 enum Base58Type {
50 PUBKEY_ADDRESS,
51 SCRIPT_ADDRESS,
52 SECRET_KEY,
53 EXT_PUBLIC_KEY,
54 EXT_SECRET_KEY,
56 MAX_BASE58_TYPES
59 const Consensus::Params& GetConsensus() const { return consensus; }
60 const CMessageHeader::MessageStartChars& MessageStart() const { return pchMessageStart; }
61 int GetDefaultPort() const { return nDefaultPort; }
63 const CBlock& GenesisBlock() const { return genesis; }
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 uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
69 /** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
70 bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
71 /** Return the BIP70 network string (main, test or regtest) */
72 std::string NetworkIDString() const { return strNetworkID; }
73 const std::vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
74 const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
75 const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
76 const CCheckpointData& Checkpoints() const { return checkpointData; }
77 const ChainTxData& TxData() const { return chainTxData; }
78 protected:
79 CChainParams() {}
81 Consensus::Params consensus;
82 CMessageHeader::MessageStartChars pchMessageStart;
83 int nDefaultPort;
84 uint64_t nPruneAfterHeight;
85 std::vector<CDNSSeedData> vSeeds;
86 std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
87 std::string strNetworkID;
88 CBlock genesis;
89 std::vector<SeedSpec6> vFixedSeeds;
90 bool fDefaultConsistencyChecks;
91 bool fRequireStandard;
92 bool fMineBlocksOnDemand;
93 CCheckpointData checkpointData;
94 ChainTxData chainTxData;
97 /**
98 * Return the currently selected parameters. This won't change after app
99 * startup, except for unit tests.
101 const CChainParams &Params();
104 * @returns CChainParams for the given BIP70 chain name.
106 CChainParams& Params(const std::string& chain);
109 * Sets the params returned by Params() to those for the given BIP70 chain name.
110 * @throws std::runtime_error when the chain is not supported.
112 void SelectParams(const std::string& chain);
115 * Allows modifying the BIP9 regtest parameters.
117 void UpdateRegtestBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout);
119 #endif // BITCOIN_CHAINPARAMS_H