Skip to content

Commit f0deec5

Browse files
committed
chainparams: move CCheckpointData into chainparams.h
This unties CChainParams from its dependency on checkpoints. Instead, now it only depends on the raw checkpoint data.
1 parent eddaba7 commit f0deec5

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/chainparams.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class CMainParams : public CChainParams {
117117
fMineBlocksOnDemand = false;
118118
fTestnetToBeDeprecatedFieldRPC = false;
119119

120-
checkpointData = (Checkpoints::CCheckpointData) {
120+
checkpointData = (CCheckpointData) {
121121
boost::assign::map_list_of
122122
( 11111, uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"))
123123
( 33333, uint256S("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6"))
@@ -189,7 +189,7 @@ class CTestNetParams : public CChainParams {
189189
fMineBlocksOnDemand = false;
190190
fTestnetToBeDeprecatedFieldRPC = true;
191191

192-
checkpointData = (Checkpoints::CCheckpointData) {
192+
checkpointData = (CCheckpointData) {
193193
boost::assign::map_list_of
194194
( 546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")),
195195
1337966069,
@@ -235,7 +235,7 @@ class CRegTestParams : public CChainParams {
235235
fMineBlocksOnDemand = true;
236236
fTestnetToBeDeprecatedFieldRPC = false;
237237

238-
checkpointData = (Checkpoints::CCheckpointData){
238+
checkpointData = (CCheckpointData){
239239
boost::assign::map_list_of
240240
( 0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")),
241241
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)