]> Git Repo - VerusCoin.git/blame - src/chainparams.h
Add MineBlocksOnDemand chain parameter
[VerusCoin.git] / src / chainparams.h
CommitLineData
0e4b3175
MH
1// Copyright (c) 2009-2010 Satoshi Nakamoto
2// Copyright (c) 2009-2013 The Bitcoin developers
3// Distributed under the MIT/X11 software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef BITCOIN_CHAIN_PARAMS_H
7#define BITCOIN_CHAIN_PARAMS_H
8
0e4b3175 9#include "uint256.h"
0e4b3175
MH
10
11#include <vector>
12
13using namespace std;
14
15#define MESSAGE_START_SIZE 4
16typedef unsigned char MessageStartChars[MESSAGE_START_SIZE];
17
18class CAddress;
19class CBlock;
20
21struct CDNSSeedData {
22 string name, host;
23 CDNSSeedData(const string &strName, const string &strHost) : name(strName), host(strHost) {}
24};
25
26/**
27 * CChainParams defines various tweakable parameters of a given instance of the
28 * Bitcoin system. There are three: the main network on which people trade goods
29 * and services, the public test network which gets reset from time to time and
30 * a regression test mode which is intended for private networks only. It has
31 * minimal difficulty to ensure that blocks can be found instantly.
32 */
33class CChainParams
34{
35public:
36 enum Network {
37 MAIN,
38 TESTNET,
39 REGTEST,
b94595bb
GA
40
41 MAX_NETWORK_TYPES
0e4b3175
MH
42 };
43
44 enum Base58Type {
45 PUBKEY_ADDRESS,
46 SCRIPT_ADDRESS,
47 SECRET_KEY,
eb2c9990
PW
48 EXT_PUBLIC_KEY,
49 EXT_SECRET_KEY,
0e4b3175
MH
50
51 MAX_BASE58_TYPES
52 };
53
54 const uint256& HashGenesisBlock() const { return hashGenesisBlock; }
55 const MessageStartChars& MessageStart() const { return pchMessageStart; }
56 const vector<unsigned char>& AlertKey() const { return vAlertPubKey; }
57 int GetDefaultPort() const { return nDefaultPort; }
df9eb5e1 58 const uint256& ProofOfWorkLimit() const { return bnProofOfWorkLimit; }
0e4b3175
MH
59 int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; }
60 virtual const CBlock& GenesisBlock() const = 0;
61 virtual bool RequireRPCPassword() const { return true; }
1712adbe 62 /* Make miner wait to have peers to avoid wasting work */
63 virtual bool MiningRequiresPeers() const { return true; }
0e4b3175 64 const string& DataDir() const { return strDataDir; }
bfa9a1a6 65 /* Make miner stop after a block is found. In RPC, don't return
66 * until nGenProcLimit blocks are generated */
67 virtual bool MineBlocksOnDemand() const { return false; }
0e4b3175
MH
68 virtual Network NetworkID() const = 0;
69 const vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
8388289e 70 const std::vector<unsigned char> &Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
0e4b3175
MH
71 virtual const vector<CAddress>& FixedSeeds() const = 0;
72 int RPCPort() const { return nRPCPort; }
73protected:
96b9603c 74 CChainParams() {}
0e4b3175
MH
75
76 uint256 hashGenesisBlock;
77 MessageStartChars pchMessageStart;
78 // Raw pub key bytes for the broadcast alert signing key.
79 vector<unsigned char> vAlertPubKey;
80 int nDefaultPort;
81 int nRPCPort;
df9eb5e1 82 uint256 bnProofOfWorkLimit;
0e4b3175
MH
83 int nSubsidyHalvingInterval;
84 string strDataDir;
85 vector<CDNSSeedData> vSeeds;
8388289e 86 std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
0e4b3175
MH
87};
88
89/**
90 * Return the currently selected parameters. This won't change after app startup
91 * outside of the unit tests.
92 */
93const CChainParams &Params();
94
95/** Sets the params returned by Params() to those for the given network. */
96void SelectParams(CChainParams::Network network);
97
98/**
99 * Looks for -regtest or -testnet and then calls SelectParams as appropriate.
100 * Returns false if an invalid combination is given.
101 */
102bool SelectParamsFromCommandLine();
103
104inline bool TestNet() {
105 // Note: it's deliberate that this returns "false" for regression test mode.
106 return Params().NetworkID() == CChainParams::TESTNET;
107}
108
2461aba1
PW
109inline bool RegTest() {
110 return Params().NetworkID() == CChainParams::REGTEST;
111}
112
0e4b3175 113#endif
This page took 0.071733 seconds and 4 git commands to generate.