Merge pull request #5142

02fe12d Update generate-seeds.py to produce doxygen compatible comments (Michael Ford)
f2e03ff Update comments in chainparams to be doxygen compatible (Michael Ford)
2fdc335 Update comments in chain to be doxygen compatible (Michael Ford)
This commit is contained in:
Wladimir J. van der Laan 2014-10-30 10:10:19 +01:00
commit f157cbb443
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
8 changed files with 140 additions and 124 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python #!/usr/bin/python
# Copyright (c) 2014 Wladmir J. van der Laan # Copyright (c) 2014 Wladmir J. van der Laan
# Distributed under the MIT/X11 software license, see the accompanying # Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
''' '''
Script to generate list of seed nodes for chainparams.cpp. Script to generate list of seed nodes for chainparams.cpp.
@ -116,10 +116,13 @@ def main():
indir = sys.argv[1] indir = sys.argv[1]
g.write('#ifndef H_CHAINPARAMSSEEDS\n') g.write('#ifndef H_CHAINPARAMSSEEDS\n')
g.write('#define H_CHAINPARAMSSEEDS\n') g.write('#define H_CHAINPARAMSSEEDS\n')
g.write('// List of fixed seed nodes for the bitcoin network\n') g.write('/**\n')
g.write('// AUTOGENERATED by contrib/devtools/generate-seeds.py\n\n') g.write(' * List of fixed seed nodes for the bitcoin network\n')
g.write('// Each line contains a 16-byte IPv6 address and a port.\n') g.write(' * AUTOGENERATED by share/seeds/generate-seeds.py\n')
g.write('// IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.\n') g.write(' *\n')
g.write(' * Each line contains a 16-byte IPv6 address and a port.\n')
g.write(' * IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.\n')
g.write(' */\n')
with open(os.path.join(indir,'nodes_main.txt'),'r') as f: with open(os.path.join(indir,'nodes_main.txt'),'r') as f:
process_nodes(g, f, 'pnSeed6_main', 8333) process_nodes(g, f, 'pnSeed6_main', 8333)
g.write('\n') g.write('\n')

View File

@ -7,8 +7,9 @@
using namespace std; using namespace std;
// CChain implementation /**
* CChain implementation
*/
void CChain::SetTip(CBlockIndex *pindex) { void CChain::SetTip(CBlockIndex *pindex) {
if (pindex == NULL) { if (pindex == NULL) {
vChain.clear(); vChain.clear();

View File

@ -50,38 +50,40 @@ struct CDiskBlockPos
}; };
enum BlockStatus { enum BlockStatus {
// Unused. //! Unused.
BLOCK_VALID_UNKNOWN = 0, BLOCK_VALID_UNKNOWN = 0,
// Parsed, version ok, hash satisfies claimed PoW, 1 <= vtx count <= max, timestamp not in future //! Parsed, version ok, hash satisfies claimed PoW, 1 <= vtx count <= max, timestamp not in future
BLOCK_VALID_HEADER = 1, BLOCK_VALID_HEADER = 1,
// All parent headers found, difficulty matches, timestamp >= median previous, checkpoint. Implies all parents //! All parent headers found, difficulty matches, timestamp >= median previous, checkpoint. Implies all parents
// are also at least TREE. //! are also at least TREE.
BLOCK_VALID_TREE = 2, BLOCK_VALID_TREE = 2,
// Only first tx is coinbase, 2 <= coinbase input script length <= 100, transactions valid, no duplicate txids, /**
// sigops, size, merkle root. Implies all parents are at least TREE but not necessarily TRANSACTIONS. When all * Only first tx is coinbase, 2 <= coinbase input script length <= 100, transactions valid, no duplicate txids,
// parent blocks also have TRANSACTIONS, CBlockIndex::nChainTx will be set. * sigops, size, merkle root. Implies all parents are at least TREE but not necessarily TRANSACTIONS. When all
* parent blocks also have TRANSACTIONS, CBlockIndex::nChainTx will be set.
*/
BLOCK_VALID_TRANSACTIONS = 3, BLOCK_VALID_TRANSACTIONS = 3,
// Outputs do not overspend inputs, no double spends, coinbase output ok, immature coinbase spends, BIP30. //! Outputs do not overspend inputs, no double spends, coinbase output ok, immature coinbase spends, BIP30.
// Implies all parents are also at least CHAIN. //! Implies all parents are also at least CHAIN.
BLOCK_VALID_CHAIN = 4, BLOCK_VALID_CHAIN = 4,
// Scripts & signatures ok. Implies all parents are also at least SCRIPTS. //! Scripts & signatures ok. Implies all parents are also at least SCRIPTS.
BLOCK_VALID_SCRIPTS = 5, BLOCK_VALID_SCRIPTS = 5,
// All validity bits. //! All validity bits.
BLOCK_VALID_MASK = BLOCK_VALID_HEADER | BLOCK_VALID_TREE | BLOCK_VALID_TRANSACTIONS | BLOCK_VALID_MASK = BLOCK_VALID_HEADER | BLOCK_VALID_TREE | BLOCK_VALID_TRANSACTIONS |
BLOCK_VALID_CHAIN | BLOCK_VALID_SCRIPTS, BLOCK_VALID_CHAIN | BLOCK_VALID_SCRIPTS,
BLOCK_HAVE_DATA = 8, // full block available in blk*.dat BLOCK_HAVE_DATA = 8, //! full block available in blk*.dat
BLOCK_HAVE_UNDO = 16, // undo data available in rev*.dat BLOCK_HAVE_UNDO = 16, //! undo data available in rev*.dat
BLOCK_HAVE_MASK = BLOCK_HAVE_DATA | BLOCK_HAVE_UNDO, BLOCK_HAVE_MASK = BLOCK_HAVE_DATA | BLOCK_HAVE_UNDO,
BLOCK_FAILED_VALID = 32, // stage after last reached validness failed BLOCK_FAILED_VALID = 32, //! stage after last reached validness failed
BLOCK_FAILED_CHILD = 64, // descends from failed block BLOCK_FAILED_CHILD = 64, //! descends from failed block
BLOCK_FAILED_MASK = BLOCK_FAILED_VALID | BLOCK_FAILED_CHILD, BLOCK_FAILED_MASK = BLOCK_FAILED_VALID | BLOCK_FAILED_CHILD,
}; };
@ -93,49 +95,50 @@ enum BlockStatus {
class CBlockIndex class CBlockIndex
{ {
public: public:
// pointer to the hash of the block, if any. memory is owned by this CBlockIndex //! pointer to the hash of the block, if any. memory is owned by this CBlockIndex
const uint256* phashBlock; const uint256* phashBlock;
// pointer to the index of the predecessor of this block //! pointer to the index of the predecessor of this block
CBlockIndex* pprev; CBlockIndex* pprev;
// pointer to the index of some further predecessor of this block //! pointer to the index of some further predecessor of this block
CBlockIndex* pskip; CBlockIndex* pskip;
// height of the entry in the chain. The genesis block has height 0 //! height of the entry in the chain. The genesis block has height 0
int nHeight; int nHeight;
// Which # file this block is stored in (blk?????.dat) //! Which # file this block is stored in (blk?????.dat)
int nFile; int nFile;
// Byte offset within blk?????.dat where this block's data is stored //! Byte offset within blk?????.dat where this block's data is stored
unsigned int nDataPos; unsigned int nDataPos;
// Byte offset within rev?????.dat where this block's undo data is stored //! Byte offset within rev?????.dat where this block's undo data is stored
unsigned int nUndoPos; unsigned int nUndoPos;
// (memory only) Total amount of work (expected number of hashes) in the chain up to and including this block //! (memory only) Total amount of work (expected number of hashes) in the chain up to and including this block
uint256 nChainWork; uint256 nChainWork;
// Number of transactions in this block. //! Number of transactions in this block.
// Note: in a potential headers-first mode, this number cannot be relied upon //! Note: in a potential headers-first mode, this number cannot be relied upon
unsigned int nTx; unsigned int nTx;
// (memory only) Number of transactions in the chain up to and including this block. //! (memory only) Number of transactions in the chain up to and including this block.
// This value will be non-zero only if and only if transactions for this block and all its parents are available. //! This value will be non-zero only if and only if transactions for this block and all its parents are available.
unsigned int nChainTx; // change to 64-bit type when necessary; won't happen before 2030 //! Change to 64-bit type when necessary; won't happen before 2030
unsigned int nChainTx;
// Verification status of this block. See enum BlockStatus //! Verification status of this block. See enum BlockStatus
unsigned int nStatus; unsigned int nStatus;
// block header //! block header
int nVersion; int nVersion;
uint256 hashMerkleRoot; uint256 hashMerkleRoot;
unsigned int nTime; unsigned int nTime;
unsigned int nBits; unsigned int nBits;
unsigned int nNonce; unsigned int nNonce;
// (memory only) Sequencial id assigned to distinguish order in which blocks are received. //! (memory only) Sequential id assigned to distinguish order in which blocks are received.
uint32_t nSequenceId; uint32_t nSequenceId;
void SetNull() void SetNull()
@ -254,7 +257,7 @@ public:
GetBlockHash().ToString()); GetBlockHash().ToString());
} }
// Check whether this block index entry is valid up to the passed validity level. //! Check whether this block index entry is valid up to the passed validity level.
bool IsValid(enum BlockStatus nUpTo = BLOCK_VALID_TRANSACTIONS) const bool IsValid(enum BlockStatus nUpTo = BLOCK_VALID_TRANSACTIONS) const
{ {
assert(!(nUpTo & ~BLOCK_VALID_MASK)); // Only validity flags allowed. assert(!(nUpTo & ~BLOCK_VALID_MASK)); // Only validity flags allowed.
@ -263,8 +266,8 @@ public:
return ((nStatus & BLOCK_VALID_MASK) >= nUpTo); return ((nStatus & BLOCK_VALID_MASK) >= nUpTo);
} }
// Raise the validity level of this block index entry. //! Raise the validity level of this block index entry.
// Returns true if the validity was changed. //! Returns true if the validity was changed.
bool RaiseValidity(enum BlockStatus nUpTo) bool RaiseValidity(enum BlockStatus nUpTo)
{ {
assert(!(nUpTo & ~BLOCK_VALID_MASK)); // Only validity flags allowed. assert(!(nUpTo & ~BLOCK_VALID_MASK)); // Only validity flags allowed.
@ -277,10 +280,10 @@ public:
return false; return false;
} }
// Build the skiplist pointer for this entry. //! Build the skiplist pointer for this entry.
void BuildSkip(); void BuildSkip();
// Efficiently find an ancestor of this block. //! Efficiently find an ancestor of this block.
CBlockIndex* GetAncestor(int height); CBlockIndex* GetAncestor(int height);
const CBlockIndex* GetAncestor(int height) const; const CBlockIndex* GetAncestor(int height) const;
}; };

View File

@ -1,6 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "chainparams.h" #include "chainparams.h"
@ -23,11 +23,11 @@ struct SeedSpec6 {
#include "chainparamsseeds.h" #include "chainparamsseeds.h"
// /**
// Main network * Main network
// */
// Convert the pnSeeds6 array into usable address objects. //! Convert the pnSeeds6 array into usable address objects.
static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *data, unsigned int count) static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *data, unsigned int count)
{ {
// It'll only connect to one or two seed nodes because once it connects, // It'll only connect to one or two seed nodes because once it connects,
@ -45,11 +45,13 @@ static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *data
} }
} }
// What makes a good checkpoint block? /**
// + Is surrounded by blocks with reasonable timestamps * What makes a good checkpoint block?
// (no blocks before with a timestamp after, none after with * + Is surrounded by blocks with reasonable timestamps
// timestamp before) * (no blocks before with a timestamp after, none after with
// + Contains no strange transactions * timestamp before)
* + Contains no strange transactions
*/
static Checkpoints::MapCheckpoints mapCheckpoints = static Checkpoints::MapCheckpoints mapCheckpoints =
boost::assign::map_list_of boost::assign::map_list_of
( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) ( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"))
@ -101,9 +103,11 @@ public:
CMainParams() { CMainParams() {
networkID = CBaseChainParams::MAIN; networkID = CBaseChainParams::MAIN;
strNetworkID = "main"; strNetworkID = "main";
// The message start string is designed to be unlikely to occur in normal data. /**
// The characters are rarely used upper ASCII, not valid as UTF-8, and produce * The message start string is designed to be unlikely to occur in normal data.
// a large 4-byte int at any alignment. * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
* a large 4-byte int at any alignment.
*/
pchMessageStart[0] = 0xf9; pchMessageStart[0] = 0xf9;
pchMessageStart[1] = 0xbe; pchMessageStart[1] = 0xbe;
pchMessageStart[2] = 0xb4; pchMessageStart[2] = 0xb4;
@ -119,14 +123,16 @@ public:
nTargetTimespan = 14 * 24 * 60 * 60; // two weeks nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
nTargetSpacing = 10 * 60; nTargetSpacing = 10 * 60;
// Build the genesis block. Note that the output of the genesis coinbase cannot /**
// be spent as it did not originally exist in the database. * Build the genesis block. Note that the output of the genesis coinbase cannot
// * be spent as it did not originally exist in the database.
// CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1) *
// CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0) * CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
// CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73) * CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
// CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B) * CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
// vMerkleTree: 4a5e1e * CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
* vMerkleTree: 4a5e1e
*/
const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"; const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
CMutableTransaction txNew; CMutableTransaction txNew;
txNew.vin.resize(1); txNew.vin.resize(1);
@ -178,18 +184,19 @@ public:
}; };
static CMainParams mainParams; static CMainParams mainParams;
// /**
// Testnet (v3) * Testnet (v3)
// */
class CTestNetParams : public CMainParams { class CTestNetParams : public CMainParams {
public: public:
CTestNetParams() { CTestNetParams() {
networkID = CBaseChainParams::TESTNET; networkID = CBaseChainParams::TESTNET;
strNetworkID = "test"; strNetworkID = "test";
// The message start string is designed to be unlikely to occur in normal data. /**
// The characters are rarely used upper ASCII, not valid as UTF-8, and produce * The message start string is designed to be unlikely to occur in normal data.
// a large 4-byte int at any alignment. * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
* a large 4-byte int at any alignment.
*/
pchMessageStart[0] = 0x0b; pchMessageStart[0] = 0x0b;
pchMessageStart[1] = 0x11; pchMessageStart[1] = 0x11;
pchMessageStart[2] = 0x09; pchMessageStart[2] = 0x09;
@ -200,10 +207,10 @@ public:
nRejectBlockOutdatedMajority = 75; nRejectBlockOutdatedMajority = 75;
nToCheckBlockUpgradeMajority = 100; nToCheckBlockUpgradeMajority = 100;
nMinerThreads = 0; nMinerThreads = 0;
nTargetTimespan = 14 * 24 * 60 * 60; // two weeks nTargetTimespan = 14 * 24 * 60 * 60; //! two weeks
nTargetSpacing = 10 * 60; nTargetSpacing = 10 * 60;
// Modify the testnet genesis block so the timestamp is valid for a later start. //! Modify the testnet genesis block so the timestamp is valid for a later start.
genesis.nTime = 1296688602; genesis.nTime = 1296688602;
genesis.nNonce = 414098458; genesis.nNonce = 414098458;
hashGenesisBlock = genesis.GetHash(); hashGenesisBlock = genesis.GetHash();
@ -239,9 +246,9 @@ public:
}; };
static CTestNetParams testNetParams; static CTestNetParams testNetParams;
// /**
// Regression test * Regression test
// */
class CRegTestParams : public CTestNetParams { class CRegTestParams : public CTestNetParams {
public: public:
CRegTestParams() { CRegTestParams() {
@ -256,7 +263,7 @@ public:
nRejectBlockOutdatedMajority = 950; nRejectBlockOutdatedMajority = 950;
nToCheckBlockUpgradeMajority = 1000; nToCheckBlockUpgradeMajority = 1000;
nMinerThreads = 1; nMinerThreads = 1;
nTargetTimespan = 14 * 24 * 60 * 60; // two weeks nTargetTimespan = 14 * 24 * 60 * 60; //! two weeks
nTargetSpacing = 10 * 60; nTargetSpacing = 10 * 60;
bnProofOfWorkLimit = ~uint256(0) >> 1; bnProofOfWorkLimit = ~uint256(0) >> 1;
genesis.nTime = 1296688602; genesis.nTime = 1296688602;
@ -266,8 +273,8 @@ public:
nDefaultPort = 18444; nDefaultPort = 18444;
assert(hashGenesisBlock == uint256("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")); assert(hashGenesisBlock == uint256("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
vFixedSeeds.clear(); // Regtest mode doesn't have any fixed seeds. vFixedSeeds.clear(); //! Regtest mode doesn't have any fixed seeds.
vSeeds.clear(); // Regtest mode doesn't have any DNS seeds. vSeeds.clear(); //! Regtest mode doesn't have any DNS seeds.
fRequireRPCPassword = false; fRequireRPCPassword = false;
fMiningRequiresPeers = false; fMiningRequiresPeers = false;
@ -284,17 +291,17 @@ public:
}; };
static CRegTestParams regTestParams; static CRegTestParams regTestParams;
// /**
// Unit test * Unit test
// */
class CUnitTestParams : public CMainParams, public CModifiableParams { class CUnitTestParams : public CMainParams, public CModifiableParams {
public: public:
CUnitTestParams() { CUnitTestParams() {
networkID = CBaseChainParams::UNITTEST; networkID = CBaseChainParams::UNITTEST;
strNetworkID = "unittest"; strNetworkID = "unittest";
nDefaultPort = 18445; nDefaultPort = 18445;
vFixedSeeds.clear(); vFixedSeeds.clear(); //! Unit test mode doesn't have any fixed seeds.
vSeeds.clear(); // Regtest mode doesn't have any DNS seeds. vSeeds.clear(); //! Unit test mode doesn't have any DNS seeds.
fRequireRPCPassword = false; fRequireRPCPassword = false;
fMiningRequiresPeers = false; fMiningRequiresPeers = false;
@ -309,7 +316,7 @@ public:
return data; return data;
} }
// Published setters to allow changing values in unit test cases //! Published setters to allow changing values in unit test cases
virtual void setSubsidyHalvingInterval(int anSubsidyHalvingInterval) { nSubsidyHalvingInterval=anSubsidyHalvingInterval; } virtual void setSubsidyHalvingInterval(int anSubsidyHalvingInterval) { nSubsidyHalvingInterval=anSubsidyHalvingInterval; }
virtual void setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority) { nEnforceBlockUpgradeMajority=anEnforceBlockUpgradeMajority; } virtual void setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority) { nEnforceBlockUpgradeMajority=anEnforceBlockUpgradeMajority; }
virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority) { nRejectBlockOutdatedMajority=anRejectBlockOutdatedMajority; } virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority) { nRejectBlockOutdatedMajority=anRejectBlockOutdatedMajority; }

View File

@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_CHAIN_PARAMS_H #ifndef BITCOIN_CHAIN_PARAMS_H
@ -47,34 +47,33 @@ public:
int GetDefaultPort() const { return nDefaultPort; } int GetDefaultPort() const { return nDefaultPort; }
const uint256& ProofOfWorkLimit() const { return bnProofOfWorkLimit; } const uint256& ProofOfWorkLimit() const { return bnProofOfWorkLimit; }
int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; } int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; }
/* Used to check majorities for block version upgrade */ /** Used to check majorities for block version upgrade */
int EnforceBlockUpgradeMajority() const { return nEnforceBlockUpgradeMajority; } int EnforceBlockUpgradeMajority() const { return nEnforceBlockUpgradeMajority; }
int RejectBlockOutdatedMajority() const { return nRejectBlockOutdatedMajority; } int RejectBlockOutdatedMajority() const { return nRejectBlockOutdatedMajority; }
int ToCheckBlockUpgradeMajority() const { return nToCheckBlockUpgradeMajority; } int ToCheckBlockUpgradeMajority() const { return nToCheckBlockUpgradeMajority; }
/* Used if GenerateBitcoins is called with a negative number of threads */ /** Used if GenerateBitcoins is called with a negative number of threads */
int DefaultMinerThreads() const { return nMinerThreads; } int DefaultMinerThreads() const { return nMinerThreads; }
const CBlock& GenesisBlock() const { return genesis; } const CBlock& GenesisBlock() const { return genesis; }
bool RequireRPCPassword() const { return fRequireRPCPassword; } bool RequireRPCPassword() const { return fRequireRPCPassword; }
/* Make miner wait to have peers to avoid wasting work */ /** Make miner wait to have peers to avoid wasting work */
bool MiningRequiresPeers() const { return fMiningRequiresPeers; } bool MiningRequiresPeers() const { return fMiningRequiresPeers; }
/* Default value for -checkmempool argument */ /** Default value for -checkmempool argument */
bool DefaultCheckMemPool() const { return fDefaultCheckMemPool; } bool DefaultCheckMemPool() const { return fDefaultCheckMemPool; }
/* Allow mining of a min-difficulty block */ /** Allow mining of a min-difficulty block */
bool AllowMinDifficultyBlocks() const { return fAllowMinDifficultyBlocks; } bool AllowMinDifficultyBlocks() const { return fAllowMinDifficultyBlocks; }
/* Skip proof-of-work check: allow mining of any difficulty block */ /** Skip proof-of-work check: allow mining of any difficulty block */
bool SkipProofOfWorkCheck() const { return fSkipProofOfWorkCheck; } bool SkipProofOfWorkCheck() const { return fSkipProofOfWorkCheck; }
/* Make standard checks */ /** Make standard checks */
bool RequireStandard() const { return fRequireStandard; } bool RequireStandard() const { return fRequireStandard; }
int64_t TargetTimespan() const { return nTargetTimespan; } int64_t TargetTimespan() const { return nTargetTimespan; }
int64_t TargetSpacing() const { return nTargetSpacing; } int64_t TargetSpacing() const { return nTargetSpacing; }
int64_t Interval() const { return nTargetTimespan / nTargetSpacing; } int64_t Interval() const { return nTargetTimespan / nTargetSpacing; }
/* Make miner stop after a block is found. In RPC, don't return /** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
* until nGenProcLimit blocks are generated */
bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; } bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
/* In the future use NetworkIDString() for RPC fields */ /** In the future use NetworkIDString() for RPC fields */
bool TestnetToBeDeprecatedFieldRPC() const { return fTestnetToBeDeprecatedFieldRPC; } bool TestnetToBeDeprecatedFieldRPC() const { return fTestnetToBeDeprecatedFieldRPC; }
/* Return the BIP70 network string (main, test or regtest) */ /** Return the BIP70 network string (main, test or regtest) */
std::string NetworkIDString() const { return strNetworkID; } std::string NetworkIDString() const { return strNetworkID; }
const std::vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; } const std::vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; } const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
@ -85,7 +84,7 @@ protected:
uint256 hashGenesisBlock; uint256 hashGenesisBlock;
MessageStartChars pchMessageStart; MessageStartChars pchMessageStart;
// Raw pub key bytes for the broadcast alert signing key. //! Raw pub key bytes for the broadcast alert signing key.
std::vector<unsigned char> vAlertPubKey; std::vector<unsigned char> vAlertPubKey;
int nDefaultPort; int nDefaultPort;
uint256 bnProofOfWorkLimit; uint256 bnProofOfWorkLimit;
@ -112,14 +111,15 @@ protected:
bool fTestnetToBeDeprecatedFieldRPC; bool fTestnetToBeDeprecatedFieldRPC;
}; };
/** Modifiable parameters interface is used by test cases to adapt the parameters in order /**
*** to test specific features more easily. Test cases should always restore the previous * Modifiable parameters interface is used by test cases to adapt the parameters in order
*** values after finalization. * to test specific features more easily. Test cases should always restore the previous
**/ * values after finalization.
*/
class CModifiableParams { class CModifiableParams {
public: public:
// Published setters to allow changing values in unit test cases //! Published setters to allow changing values in unit test cases
virtual void setSubsidyHalvingInterval(int anSubsidyHalvingInterval) =0; virtual void setSubsidyHalvingInterval(int anSubsidyHalvingInterval) =0;
virtual void setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority)=0; virtual void setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority)=0;
virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority)=0; virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority)=0;
@ -139,7 +139,7 @@ const CChainParams &Params();
/** Return parameters for the given network. */ /** Return parameters for the given network. */
CChainParams &Params(CBaseChainParams::Network network); CChainParams &Params(CBaseChainParams::Network network);
/** Get modifyable network parameters (UNITTEST only) */ /** Get modifiable network parameters (UNITTEST only) */
CModifiableParams *ModifiableParams(); CModifiableParams *ModifiableParams();
/** Sets the params returned by Params() to those for the given network. */ /** Sets the params returned by Params() to those for the given network. */

View File

@ -1,6 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "chainparamsbase.h" #include "chainparamsbase.h"
@ -13,10 +13,9 @@
using namespace boost::assign; using namespace boost::assign;
// /**
// Main network * Main network
// */
class CBaseMainParams : public CBaseChainParams class CBaseMainParams : public CBaseChainParams
{ {
public: public:
@ -28,9 +27,9 @@ public:
}; };
static CBaseMainParams mainParams; static CBaseMainParams mainParams;
// /**
// Testnet (v3) * Testnet (v3)
// */
class CBaseTestNetParams : public CBaseMainParams class CBaseTestNetParams : public CBaseMainParams
{ {
public: public:
@ -43,9 +42,9 @@ public:
}; };
static CBaseTestNetParams testNetParams; static CBaseTestNetParams testNetParams;
// /*
// Regression test * Regression test
// */
class CBaseRegTestParams : public CBaseTestNetParams class CBaseRegTestParams : public CBaseTestNetParams
{ {
public: public:
@ -57,9 +56,9 @@ public:
}; };
static CBaseRegTestParams regTestParams; static CBaseRegTestParams regTestParams;
// /*
// Unit test * Unit test
// */
class CBaseUnitTestParams : public CBaseMainParams class CBaseUnitTestParams : public CBaseMainParams
{ {
public: public:

View File

@ -1,5 +1,5 @@
// Copyright (c) 2014 The Bitcoin developers // Copyright (c) 2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_CHAIN_PARAMS_BASE_H #ifndef BITCOIN_CHAIN_PARAMS_BASE_H

View File

@ -1,10 +1,13 @@
#ifndef H_CHAINPARAMSSEEDS #ifndef H_CHAINPARAMSSEEDS
#define H_CHAINPARAMSSEEDS #define H_CHAINPARAMSSEEDS
// List of fixed seed nodes for the bitcoin network
// AUTOGENERATED by contrib/devtools/generate-seeds.py
// Each line contains a 16-byte IPv6 address and a port. /**
// IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly. * List of fixed seed nodes for the bitcoin network
* AUTOGENERATED by contrib/devtools/generate-seeds.py
*
* Each line contains a 16-byte IPv6 address and a port.
* IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.
*/
static SeedSpec6 pnSeed6_main[] = { static SeedSpec6 pnSeed6_main[] = {
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2e,0x69,0x6a,0x7e}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2e,0x69,0x6a,0x7e}, 8333},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa2,0xd1,0x04,0x7d}, 8333}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa2,0xd1,0x04,0x7d}, 8333},