Skip to content

Commit 6996823

Browse files
committed
checkpoints: make checkpoints a member of CChainParams
This drops the virtual call and simplifies the logic
1 parent 9f13a10 commit 6996823

File tree

2 files changed

+39
-58
lines changed

2 files changed

+39
-58
lines changed

src/chainparams.cpp

Lines changed: 37 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -26,51 +26,6 @@ using namespace std;
2626
* timestamp before)
2727
* + Contains no strange transactions
2828
*/
29-
static Checkpoints::MapCheckpoints mapCheckpoints =
30-
boost::assign::map_list_of
31-
( 11111, uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"))
32-
( 33333, uint256S("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6"))
33-
( 74000, uint256S("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20"))
34-
(105000, uint256S("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97"))
35-
(134444, uint256S("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"))
36-
(168000, uint256S("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763"))
37-
(193000, uint256S("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317"))
38-
(210000, uint256S("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e"))
39-
(216116, uint256S("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e"))
40-
(225430, uint256S("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932"))
41-
(250000, uint256S("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214"))
42-
(279000, uint256S("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40"))
43-
(295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983"))
44-
;
45-
static const Checkpoints::CCheckpointData data = {
46-
mapCheckpoints,
47-
1397080064, // * UNIX timestamp of last checkpoint block
48-
36544669, // * total number of transactions between genesis and last checkpoint
49-
// (the tx=... number in the SetBestChain debug.log lines)
50-
60000.0 // * estimated number of transactions per day after checkpoint
51-
};
52-
53-
static Checkpoints::MapCheckpoints mapCheckpointsTestnet =
54-
boost::assign::map_list_of
55-
( 546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70"))
56-
;
57-
static const Checkpoints::CCheckpointData dataTestnet = {
58-
mapCheckpointsTestnet,
59-
1337966069,
60-
1488,
61-
300
62-
};
63-
64-
static Checkpoints::MapCheckpoints mapCheckpointsRegtest =
65-
boost::assign::map_list_of
66-
( 0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"))
67-
;
68-
static const Checkpoints::CCheckpointData dataRegtest = {
69-
mapCheckpointsRegtest,
70-
0,
71-
0,
72-
0
73-
};
7429

7530
class CMainParams : public CChainParams {
7631
public:
@@ -147,11 +102,27 @@ class CMainParams : public CChainParams {
147102
fRequireStandard = true;
148103
fMineBlocksOnDemand = false;
149104
fTestnetToBeDeprecatedFieldRPC = false;
150-
}
151105

152-
const Checkpoints::CCheckpointData& Checkpoints() const
153-
{
154-
return data;
106+
checkpointData = (Checkpoints::CCheckpointData) {
107+
boost::assign::map_list_of
108+
( 11111, uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"))
109+
( 33333, uint256S("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6"))
110+
( 74000, uint256S("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20"))
111+
(105000, uint256S("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97"))
112+
(134444, uint256S("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"))
113+
(168000, uint256S("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763"))
114+
(193000, uint256S("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317"))
115+
(210000, uint256S("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e"))
116+
(216116, uint256S("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e"))
117+
(225430, uint256S("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932"))
118+
(250000, uint256S("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214"))
119+
(279000, uint256S("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40"))
120+
(295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983")),
121+
1397080064, // * UNIX timestamp of last checkpoint block
122+
36544669, // * total number of transactions between genesis and last checkpoint
123+
// (the tx=... number in the SetBestChain debug.log lines)
124+
60000.0 // * estimated number of transactions per day after checkpoint
125+
};
155126
}
156127
};
157128
static CMainParams mainParams;
@@ -203,10 +174,15 @@ class CTestNetParams : public CMainParams {
203174
fRequireStandard = false;
204175
fMineBlocksOnDemand = false;
205176
fTestnetToBeDeprecatedFieldRPC = true;
206-
}
207-
const Checkpoints::CCheckpointData& Checkpoints() const
208-
{
209-
return dataTestnet;
177+
178+
checkpointData = (Checkpoints::CCheckpointData) {
179+
boost::assign::map_list_of
180+
( 546, uint256S("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70")),
181+
1337966069,
182+
1488,
183+
300
184+
};
185+
210186
}
211187
};
212188
static CTestNetParams testNetParams;
@@ -245,10 +221,14 @@ class CRegTestParams : public CTestNetParams {
245221
fRequireStandard = false;
246222
fMineBlocksOnDemand = true;
247223
fTestnetToBeDeprecatedFieldRPC = false;
248-
}
249-
const Checkpoints::CCheckpointData& Checkpoints() const
250-
{
251-
return dataRegtest;
224+
225+
checkpointData = (Checkpoints::CCheckpointData){
226+
boost::assign::map_list_of
227+
( 0, uint256S("0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206")),
228+
0,
229+
0,
230+
0
231+
};
252232
}
253233
};
254234
static CRegTestParams regTestParams;

src/chainparams.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class CChainParams
7474
const std::vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
7575
const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
7676
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
77-
virtual const Checkpoints::CCheckpointData& Checkpoints() const = 0;
77+
const Checkpoints::CCheckpointData& Checkpoints() const { return checkpointData; }
7878
protected:
7979
CChainParams() {}
8080

@@ -96,6 +96,7 @@ class CChainParams
9696
bool fRequireStandard;
9797
bool fMineBlocksOnDemand;
9898
bool fTestnetToBeDeprecatedFieldRPC;
99+
Checkpoints::CCheckpointData checkpointData;
99100
};
100101

101102
/**

0 commit comments

Comments
 (0)