Merge #11923: Wallet : remove unused fNoncriticalErrors variable from CWalletDB:...
[bitcoinplatinum.git] / src / checkpoints.cpp
blob929d86458854d77ba5f2f91af8f364c27ac09dd4
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>
12 #include <stdint.h>
15 namespace Checkpoints {
17 CBlockIndex* GetLastCheckpoint(const CCheckpointData& data)
19 const MapCheckpoints& checkpoints = data.mapCheckpoints;
21 for (const MapCheckpoints::value_type& i : reverse_iterate(checkpoints))
23 const uint256& hash = i.second;
24 BlockMap::const_iterator t = mapBlockIndex.find(hash);
25 if (t != mapBlockIndex.end())
26 return t->second;
28 return nullptr;
31 } // namespace Checkpoints