Merge #10816: Properly forbid -salvagewallet and -zapwallettxes for multi wallet.
[bitcoinplatinum.git] / src / checkpoints.cpp
blobe6b5fb72a77ca3328ad9a41b1f8da887e3bcd8f4
1 // Copyright (c) 2009-2016 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #include "checkpoints.h"
7 #include "chain.h"
8 #include "chainparams.h"
9 #include "reverse_iterator.h"
10 #include "validation.h"
11 #include "uint256.h"
13 #include <stdint.h>
16 namespace Checkpoints {
18 CBlockIndex* GetLastCheckpoint(const CCheckpointData& data)
20 const MapCheckpoints& checkpoints = data.mapCheckpoints;
22 for (const MapCheckpoints::value_type& i : reverse_iterate(checkpoints))
24 const uint256& hash = i.second;
25 BlockMap::const_iterator t = mapBlockIndex.find(hash);
26 if (t != mapBlockIndex.end())
27 return t->second;
29 return NULL;
32 } // namespace Checkpoints