2014-01-17 13:20:43 +01:00
|
|
|
// Copyright (c) 2009-2014 The Bitcoin developers
|
2020-01-17 15:42:55 +01:00
|
|
|
// Copyright (c) 2014-2020 The Dash Core developers
|
2014-10-31 01:43:19 +01:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2012-05-18 16:02:28 +02:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
2011-09-08 22:50:58 +02:00
|
|
|
|
2020-03-19 23:46:56 +01:00
|
|
|
#include <checkpoints.h>
|
2011-09-08 22:50:58 +02:00
|
|
|
|
2020-03-19 23:46:56 +01:00
|
|
|
#include <chain.h>
|
|
|
|
#include <chainparams.h>
|
|
|
|
#include <reverse_iterator.h>
|
|
|
|
#include <validation.h>
|
2012-04-15 22:10:54 +02:00
|
|
|
|
2013-04-13 07:13:08 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
2014-06-24 14:17:43 +02:00
|
|
|
namespace Checkpoints {
|
2011-09-08 22:50:58 +02:00
|
|
|
|
2015-04-23 00:19:11 +02:00
|
|
|
CBlockIndex* GetLastCheckpoint(const CCheckpointData& data)
|
2011-09-08 18:51:43 +02:00
|
|
|
{
|
2015-04-23 00:19:11 +02:00
|
|
|
const MapCheckpoints& checkpoints = data.mapCheckpoints;
|
2011-09-08 18:51:43 +02:00
|
|
|
|
2019-07-13 06:58:15 +02:00
|
|
|
for (const MapCheckpoints::value_type& i : reverse_iterate(checkpoints))
|
2011-09-08 18:51:43 +02:00
|
|
|
{
|
|
|
|
const uint256& hash = i.second;
|
2014-09-04 02:02:44 +02:00
|
|
|
BlockMap::const_iterator t = mapBlockIndex.find(hash);
|
2011-09-08 18:51:43 +02:00
|
|
|
if (t != mapBlockIndex.end())
|
|
|
|
return t->second;
|
|
|
|
}
|
2019-08-06 05:08:33 +02:00
|
|
|
return nullptr;
|
2011-09-08 18:51:43 +02:00
|
|
|
}
|
2014-06-24 14:17:43 +02:00
|
|
|
|
|
|
|
} // namespace Checkpoints
|