1313
1414namespace Checkpoints
1515{
16- struct Checkpoint
17- {
18- uint256 hashCheckPoint;
19- unsigned int nTime;
20- };
21-
22- typedef std::map<int , Checkpoint> MapCheckpoints;
23-
24- Checkpoint initCheckpoint (uint256 hashCheckPoint, unsigned int nTime)
25- {
26- Checkpoint item;
27- item.hashCheckPoint = hashCheckPoint;
28- item.nTime = nTime;
29-
30- return item;
31- }
16+ typedef std::map<int , std::pair<uint256, unsigned int > > MapCheckpoints;
3217
3318 //
3419 // What makes a good checkpoint block?
@@ -39,18 +24,18 @@ namespace Checkpoints
3924 //
4025 static MapCheckpoints mapCheckpoints =
4126 boost::assign::map_list_of
42- ( 0 , initCheckpoint (hashGenesisBlock, 1360105017 ) )
43- ( 9690 , initCheckpoint (uint256(" 0x00000000026561450859c46868099e0df6068a538f038cb18988fd8d47dcdaf5" ), 1362791423 ) )
44- ( 13560 , initCheckpoint (uint256(" 0xa1591a0fcbf11f282d671581edb9f0aadcd06fee69761081e0a3245914c13729" ), 1364674052 ) )
45- ( 37092 , initCheckpoint (uint256(" 0x0000000000a38c2f98556f46793b453e92d8fab2d31c0b93fd08bcf78e56099d" ), 1376677203 ) )
46- ( 44200 , initCheckpoint (uint256(" 0xc9bda7232a18b9c1f5ff974a9e5566b2d1879ceb8fc0e9e61fba9038a25b8447" ), 1380145962 ) )
47- ( 65000 , initCheckpoint (uint256(" 0xfb2b51a2fd65062c98a7a6053cde46aeaefebb95ba2f680e85a29ee25b1dcf05" ), 1388526385 ) )
27+ ( 0 , std::make_pair (hashGenesisBlock, 1360105017 ) )
28+ ( 9690 , std::make_pair (uint256(" 0x00000000026561450859c46868099e0df6068a538f038cb18988fd8d47dcdaf5" ), 1362791423 ) )
29+ ( 13560 , std::make_pair (uint256(" 0xa1591a0fcbf11f282d671581edb9f0aadcd06fee69761081e0a3245914c13729" ), 1364674052 ) )
30+ ( 37092 , std::make_pair (uint256(" 0x0000000000a38c2f98556f46793b453e92d8fab2d31c0b93fd08bcf78e56099d" ), 1376677203 ) )
31+ ( 44200 , std::make_pair (uint256(" 0xc9bda7232a18b9c1f5ff974a9e5566b2d1879ceb8fc0e9e61fba9038a25b8447" ), 1380145962 ) )
32+ ( 65000 , std::make_pair (uint256(" 0xfb2b51a2fd65062c98a7a6053cde46aeaefebb95ba2f680e85a29ee25b1dcf05" ), 1388526385 ) )
4833 ;
4934
5035 // TestNet has no checkpoints
5136 static MapCheckpoints mapCheckpointsTestnet =
5237 boost::assign::map_list_of
53- ( 0 , initCheckpoint (hashGenesisBlockTestNet, 1360105017 ) )
38+ ( 0 , std::make_pair (hashGenesisBlockTestNet, 1360105017 ) )
5439 ;
5540
5641 bool CheckHardened (int nHeight, const uint256& hash)
@@ -59,7 +44,7 @@ namespace Checkpoints
5944
6045 MapCheckpoints::const_iterator i = checkpoints.find (nHeight);
6146 if (i == checkpoints.end ()) return true ;
62- return hash == i->second .hashCheckPoint ;
47+ return hash == i->second .first ;
6348 }
6449
6550 int GetTotalBlocksEstimate ()
@@ -73,7 +58,7 @@ namespace Checkpoints
7358 {
7459 MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
7560
76- return checkpoints.rbegin ()->second .nTime ;
61+ return checkpoints.rbegin ()->second .second ;
7762 }
7863
7964 CBlockIndex* GetLastCheckpoint (const std::map<uint256, CBlockIndex*>& mapBlockIndex)
@@ -82,7 +67,7 @@ namespace Checkpoints
8267
8368 BOOST_REVERSE_FOREACH (const MapCheckpoints::value_type& i, checkpoints)
8469 {
85- const uint256& hash = i.second .hashCheckPoint ;
70+ const uint256& hash = i.second .first ;
8671 std::map<uint256, CBlockIndex*>::const_iterator t = mapBlockIndex.find (hash);
8772 if (t != mapBlockIndex.end ())
8873 return t->second ;
@@ -266,7 +251,7 @@ namespace Checkpoints
266251 bool ResetSyncCheckpoint ()
267252 {
268253 LOCK (cs_hashSyncCheckpoint);
269- const uint256& hash = mapCheckpoints.rbegin ()->second .hashCheckPoint ;
254+ const uint256& hash = mapCheckpoints.rbegin ()->second .first ;
270255 if (mapBlockIndex.count (hash) && !mapBlockIndex[hash]->IsInMainChain ())
271256 {
272257 // checkpoint block accepted but not yet in main chain
@@ -290,7 +275,7 @@ namespace Checkpoints
290275
291276 BOOST_REVERSE_FOREACH (const MapCheckpoints::value_type& i, mapCheckpoints)
292277 {
293- const uint256& hash = i.second .hashCheckPoint ;
278+ const uint256& hash = i.second .first ;
294279 if (mapBlockIndex.count (hash) && mapBlockIndex[hash]->IsInMainChain ())
295280 {
296281 if (!WriteSyncCheckpoint (hash))
0 commit comments