Skip to content

Commit e3f13dd

Browse files
committed
Merge pull request #6242
17221bf chainparams: don't use std namespace (Cory Fields) f0deec5 chainparams: move CCheckpointData into chainparams.h (Cory Fields)
2 parents e128464 + 17221bf commit e3f13dd

File tree

4 files changed

+16
-18
lines changed

4 files changed

+16
-18
lines changed

src/chainparams.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
#include <boost/assign/list_of.hpp>
1414

15-
using namespace std;
16-
1715
#include "chainparamsseeds.h"
1816

1917
static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
@@ -22,7 +20,7 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi
2220
txNew.nVersion = 1;
2321
txNew.vin.resize(1);
2422
txNew.vout.resize(1);
25-
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
23+
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
2624
txNew.vout[0].nValue = genesisReward;
2725
txNew.vout[0].scriptPubKey = genesisOutputScript;
2826

@@ -117,7 +115,7 @@ class CMainParams : public CChainParams {
117115
fMineBlocksOnDemand = false;
118116
fTestnetToBeDeprecatedFieldRPC = false;
119117

120-
checkpointData = (Checkpoints::CCheckpointData) {
118+
checkpointData = (CCheckpointData) {
121119
boost::assign::map_list_of
122120
( 11111, uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"))
123121
( 33333, uint256S("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6"))
@@ -190,7 +188,7 @@ class CTestNetParams : public CChainParams {
190188
fMineBlocksOnDemand = false;
191189
fTestnetToBeDeprecatedFieldRPC = true;
192190

193-
checkpointData = (Checkpoints::CCheckpointData) {
191+
checkpointData = (CCheckpointData) {
194192
boost::assign::map_list_of
195193
( 546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")),
196194
1337966069,
@@ -239,7 +237,7 @@ class CRegTestParams : public CChainParams {
239237
fMineBlocksOnDemand = true;
240238
fTestnetToBeDeprecatedFieldRPC = false;
241239

242-
checkpointData = (Checkpoints::CCheckpointData){
240+
checkpointData = (CCheckpointData){
243241
boost::assign::map_list_of
244242
( 0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")),
245243
0,

src/chainparams.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#define BITCOIN_CHAINPARAMS_H
88

99
#include "chainparamsbase.h"
10-
#include "checkpoints.h"
1110
#include "consensus/params.h"
1211
#include "primitives/block.h"
1312
#include "protocol.h"
@@ -24,6 +23,14 @@ struct SeedSpec6 {
2423
uint16_t port;
2524
};
2625

26+
typedef std::map<int, uint256> MapCheckpoints;
27+
28+
struct CCheckpointData {
29+
MapCheckpoints mapCheckpoints;
30+
int64_t nTimeLastCheckpoint;
31+
int64_t nTransactionsLastCheckpoint;
32+
double fTransactionsPerDay;
33+
};
2734

2835
/**
2936
* CChainParams defines various tweakable parameters of a given instance of the
@@ -67,7 +74,7 @@ class CChainParams
6774
const std::vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
6875
const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
6976
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
70-
const Checkpoints::CCheckpointData& Checkpoints() const { return checkpointData; }
77+
const CCheckpointData& Checkpoints() const { return checkpointData; }
7178
protected:
7279
CChainParams() {}
7380

@@ -87,7 +94,7 @@ class CChainParams
8794
bool fRequireStandard;
8895
bool fMineBlocksOnDemand;
8996
bool fTestnetToBeDeprecatedFieldRPC;
90-
Checkpoints::CCheckpointData checkpointData;
97+
CCheckpointData checkpointData;
9198
};
9299

93100
/**

src/checkpoints.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,14 @@
1010
#include <map>
1111

1212
class CBlockIndex;
13+
struct CCheckpointData;
1314

1415
/**
1516
* Block-chain checkpoints are compiled-in sanity checks.
1617
* They are updated every release or three.
1718
*/
1819
namespace Checkpoints
1920
{
20-
typedef std::map<int, uint256> MapCheckpoints;
21-
22-
struct CCheckpointData {
23-
MapCheckpoints mapCheckpoints;
24-
int64_t nTimeLastCheckpoint;
25-
int64_t nTransactionsLastCheckpoint;
26-
double fTransactionsPerDay;
27-
};
2821

2922
//! Return conservative estimate of total number of blocks, 0 if unknown
3023
int GetTotalBlocksEstimate(const CCheckpointData& data);

src/test/Checkpoints_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ BOOST_FIXTURE_TEST_SUITE(Checkpoints_tests, BasicTestingSetup)
2020

2121
BOOST_AUTO_TEST_CASE(sanity)
2222
{
23-
const Checkpoints::CCheckpointData& checkpoints = Params(CBaseChainParams::MAIN).Checkpoints();
23+
const CCheckpointData& checkpoints = Params(CBaseChainParams::MAIN).Checkpoints();
2424
BOOST_CHECK(Checkpoints::GetTotalBlocksEstimate(checkpoints) >= 134444);
2525
}
2626

0 commit comments

Comments
 (0)