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