From f2e03ffae92ec1333c0eb724835ad56138f54716 Mon Sep 17 00:00:00 2001 From: Michael Ford Date: Sat, 25 Oct 2014 17:24:16 +0800 Subject: [PATCH] Update comments in chainparams to be doxygen compatible --- src/chainparams.cpp | 91 ++++++++++++++++++++++------------------- src/chainparams.h | 40 +++++++++--------- src/chainparamsbase.cpp | 27 ++++++------ src/chainparamsbase.h | 2 +- src/chainparamsseeds.h | 11 +++-- 5 files changed, 90 insertions(+), 81 deletions(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 1ab292517..9ffc369b4 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2010 Satoshi Nakamoto // 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. #include "chainparams.h" @@ -23,11 +23,11 @@ struct SeedSpec6 { #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 &vSeedsOut, const SeedSpec6 *data, unsigned int count) { // It'll only connect to one or two seed nodes because once it connects, @@ -45,11 +45,13 @@ static void convertSeed6(std::vector &vSeedsOut, const SeedSpec6 *data } } - // What makes a good checkpoint block? - // + Is surrounded by blocks with reasonable timestamps - // (no blocks before with a timestamp after, none after with - // timestamp before) - // + Contains no strange transactions +/** + * What makes a good checkpoint block? + * + Is surrounded by blocks with reasonable timestamps + * (no blocks before with a timestamp after, none after with + * timestamp before) + * + Contains no strange transactions + */ static Checkpoints::MapCheckpoints mapCheckpoints = boost::assign::map_list_of ( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) @@ -101,9 +103,11 @@ public: CMainParams() { networkID = CBaseChainParams::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 - // a large 4-byte int at any alignment. + /** + * 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 + * a large 4-byte int at any alignment. + */ pchMessageStart[0] = 0xf9; pchMessageStart[1] = 0xbe; pchMessageStart[2] = 0xb4; @@ -119,14 +123,16 @@ public: nTargetTimespan = 14 * 24 * 60 * 60; // two weeks 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. - // - // 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) - // CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73) - // CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B) - // vMerkleTree: 4a5e1e + /** + * 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) + * CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73) + * CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B) + * vMerkleTree: 4a5e1e + */ const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"; CMutableTransaction txNew; txNew.vin.resize(1); @@ -178,18 +184,19 @@ public: }; static CMainParams mainParams; -// -// Testnet (v3) -// - +/** + * Testnet (v3) + */ class CTestNetParams : public CMainParams { public: CTestNetParams() { networkID = CBaseChainParams::TESTNET; 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 - // a large 4-byte int at any alignment. + /** + * 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 + * a large 4-byte int at any alignment. + */ pchMessageStart[0] = 0x0b; pchMessageStart[1] = 0x11; pchMessageStart[2] = 0x09; @@ -200,10 +207,10 @@ public: nRejectBlockOutdatedMajority = 75; nToCheckBlockUpgradeMajority = 100; nMinerThreads = 0; - nTargetTimespan = 14 * 24 * 60 * 60; // two weeks + nTargetTimespan = 14 * 24 * 60 * 60; //! two weeks 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.nNonce = 414098458; hashGenesisBlock = genesis.GetHash(); @@ -239,9 +246,9 @@ public: }; static CTestNetParams testNetParams; -// -// Regression test -// +/** + * Regression test + */ class CRegTestParams : public CTestNetParams { public: CRegTestParams() { @@ -256,7 +263,7 @@ public: nRejectBlockOutdatedMajority = 950; nToCheckBlockUpgradeMajority = 1000; nMinerThreads = 1; - nTargetTimespan = 14 * 24 * 60 * 60; // two weeks + nTargetTimespan = 14 * 24 * 60 * 60; //! two weeks nTargetSpacing = 10 * 60; bnProofOfWorkLimit = ~uint256(0) >> 1; genesis.nTime = 1296688602; @@ -266,8 +273,8 @@ public: nDefaultPort = 18444; assert(hashGenesisBlock == uint256("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")); - vFixedSeeds.clear(); // Regtest mode doesn't have any fixed seeds. - vSeeds.clear(); // Regtest mode doesn't have any DNS seeds. + vFixedSeeds.clear(); //! Regtest mode doesn't have any fixed seeds. + vSeeds.clear(); //! Regtest mode doesn't have any DNS seeds. fRequireRPCPassword = false; fMiningRequiresPeers = false; @@ -284,17 +291,17 @@ public: }; static CRegTestParams regTestParams; -// -// Unit test -// +/** + * Unit test + */ class CUnitTestParams : public CMainParams, public CModifiableParams { public: CUnitTestParams() { networkID = CBaseChainParams::UNITTEST; strNetworkID = "unittest"; nDefaultPort = 18445; - vFixedSeeds.clear(); - vSeeds.clear(); // Regtest mode doesn't have any DNS seeds. + vFixedSeeds.clear(); //! Unit test mode doesn't have any fixed seeds. + vSeeds.clear(); //! Unit test mode doesn't have any DNS seeds. fRequireRPCPassword = false; fMiningRequiresPeers = false; @@ -309,7 +316,7 @@ public: 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 setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority) { nEnforceBlockUpgradeMajority=anEnforceBlockUpgradeMajority; } virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority) { nRejectBlockOutdatedMajority=anRejectBlockOutdatedMajority; } diff --git a/src/chainparams.h b/src/chainparams.h index f157419bb..6eba970cc 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -1,6 +1,6 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2013 The Bitcoin developers -// Distributed under the MIT/X11 software license, see the accompanying +// Copyright (c) 2009-2014 The Bitcoin developers +// Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CHAIN_PARAMS_H @@ -47,34 +47,33 @@ public: int GetDefaultPort() const { return nDefaultPort; } const uint256& ProofOfWorkLimit() const { return bnProofOfWorkLimit; } 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 RejectBlockOutdatedMajority() const { return nRejectBlockOutdatedMajority; } 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; } const CBlock& GenesisBlock() const { return genesis; } 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; } - /* Default value for -checkmempool argument */ + /** Default value for -checkmempool argument */ bool DefaultCheckMemPool() const { return fDefaultCheckMemPool; } - /* Allow mining of a min-difficulty block */ + /** Allow mining of a min-difficulty block */ 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; } - /* Make standard checks */ + /** Make standard checks */ bool RequireStandard() const { return fRequireStandard; } int64_t TargetTimespan() const { return nTargetTimespan; } int64_t TargetSpacing() const { return nTargetSpacing; } int64_t Interval() const { return nTargetTimespan / nTargetSpacing; } - /* Make miner stop after a block is found. In RPC, don't return - * until nGenProcLimit blocks are generated */ + /** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */ 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; } - /* Return the BIP70 network string (main, test or regtest) */ + /** Return the BIP70 network string (main, test or regtest) */ std::string NetworkIDString() const { return strNetworkID; } const std::vector& DNSSeeds() const { return vSeeds; } const std::vector& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; } @@ -85,7 +84,7 @@ protected: uint256 hashGenesisBlock; MessageStartChars pchMessageStart; - // Raw pub key bytes for the broadcast alert signing key. + //! Raw pub key bytes for the broadcast alert signing key. std::vector vAlertPubKey; int nDefaultPort; uint256 bnProofOfWorkLimit; @@ -112,14 +111,15 @@ protected: 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 -*** values after finalization. -**/ +/** + * 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 + * values after finalization. + */ class CModifiableParams { 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 setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority)=0; virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority)=0; @@ -139,7 +139,7 @@ const CChainParams &Params(); /** Return parameters for the given network. */ CChainParams &Params(CBaseChainParams::Network network); -/** Get modifyable network parameters (UNITTEST only) */ +/** Get modifiable network parameters (UNITTEST only) */ CModifiableParams *ModifiableParams(); /** Sets the params returned by Params() to those for the given network. */ diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp index 5d9ec7927..8646a3160 100644 --- a/src/chainparamsbase.cpp +++ b/src/chainparamsbase.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2010 Satoshi Nakamoto // 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. #include "chainparamsbase.h" @@ -13,10 +13,9 @@ using namespace boost::assign; -// -// Main network -// - +/** + * Main network + */ class CBaseMainParams : public CBaseChainParams { public: @@ -28,9 +27,9 @@ public: }; static CBaseMainParams mainParams; -// -// Testnet (v3) -// +/** + * Testnet (v3) + */ class CBaseTestNetParams : public CBaseMainParams { public: @@ -43,9 +42,9 @@ public: }; static CBaseTestNetParams testNetParams; -// -// Regression test -// +/* + * Regression test + */ class CBaseRegTestParams : public CBaseTestNetParams { public: @@ -57,9 +56,9 @@ public: }; static CBaseRegTestParams regTestParams; -// -// Unit test -// +/* + * Unit test + */ class CBaseUnitTestParams : public CBaseMainParams { public: diff --git a/src/chainparamsbase.h b/src/chainparamsbase.h index 911d1181a..4042b8c87 100644 --- a/src/chainparamsbase.h +++ b/src/chainparamsbase.h @@ -1,5 +1,5 @@ // 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. #ifndef BITCOIN_CHAIN_PARAMS_BASE_H diff --git a/src/chainparamsseeds.h b/src/chainparamsseeds.h index 3f3278361..c3323c48b 100644 --- a/src/chainparamsseeds.h +++ b/src/chainparamsseeds.h @@ -1,10 +1,13 @@ #ifndef 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[] = { {{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},