text: // Copyright (c) 2009-2012 The Bitcoin developers
  // Distributed under the MIT/X11 software license, see the accompanying
  // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  
  #include <boost/assign/list_of.hpp> // for 'map_list_of()'
  #include <boost/foreach.hpp>
  
  #include "checkpoints.h"
  
  #include "db.h"
  #include "main.h"
  #include "uint256.h"
  
  namespace Checkpoints
  {
      typedef std::map<int, uint256> MapCheckpoints;
  
      //
      // What makes a good checkpoint block?
      // + Is surrounded by blocks with reasonable timestamps
      //   (no blocks before with a timestamp after, none after with
      //    timestamp before)
      // + Contains no strange transactions
      //
      static MapCheckpoints mapCheckpoints =
          boost::assign::map_list_of
          (     0, hashGenesisBlockOfficial )
  	(10, uint256("0x0000074074af28e73189ae5767b706246be2e0827c46d97a61178394aec877cf"))
  	(31781, uint256("0x42265210870957b8d37f91a0834c6cda65949b2ca805bb3a7d527a4cd585a090")) //official hyp fork
  	(80987, uint256("0x6b943fa756e915ddd8b654844781e21090ae9ddfcb2147fba46cac529df5be08")) //not using even number because sync gets sticky
  	(199999, uint256("0x084b314dfee7db9d311a5db4dc4b8880df36eb7e9bb90ec98dd0bab5af2a7df2"))
  	(235691, uint256("0xf0f71ea7edf7457e611ee893cdbb6ff19499713f4dae935d6d21e073d96a7dc3"))
  	(235999, uint256("0xafe60dd0ab56ef529db21ea648ea4fd8de758a11b6a8ac1fa5cd2d4959162106"))
  	(399999, uint256("0x875356232916a420c100b83d87cc9ce3eb9a174750b48d2fd1eefba7292163b5"))
  	(499999, uint256("0x8e370d8ab8bdb6e6a5a4882dda755b23b5f284f633e04c12e6f73f92de15e68e"))
      (1207950, uint256("0xbad0a0f14081129f34d42fdc617638756158fd7b1413f4d3a2916bed2c1a61d4"))
      (1377570, uint256("0x3d76cad9c096ce48336da1528ab31b5897eac41b8780fb37f64110ca034f971c"))
      (1740225, uint256("0xd6b6487ca611fb88a8b5250096e574d16a6ec6e7edb128f3cc21640556be2cab"))
      (1891672, uint256("0xf4a69e1fcce4d5af27a1e7f4662a46313e08f1e2ac03009a1b6f981afd038268"))
      (2263808, uint256("0x3bc34363b14fbe095bb32cdc9ecc5e1b1cc51bbf36dfa6ca5a5ffa940fdb7475"))
      (2547621, uint256("0x84e64faf6374e16186cd20c3a6f3aef15ab51eeb650aaf16a4daef006a284be9"))
  	;
  
      static MapCheckpoints mapCheckpointsTestnet =
          boost::assign::map_list_of
          ( 0, hashGenesisBlockTestNet )
  		(70, uint256("0x97c81df9aab50f1bef2e09ec8d806c3cc7ec6b7b7f13c70f1b854d8e40ed77c9"))
          ;
  
      bool CheckHardened(int nHeight, const uint256& hash)
      {
          MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
  
          MapCheckpoints::const_iterator i = checkpoints.find(nHeight);
          if (i == checkpoints.end()) return true;
          return hash == i->second;
      }
  
      int GetTotalBlocksEstimate()
      {
          MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
  
          return checkpoints.rbegin()->first;
      }
  
      CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
      {
          MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
  
          BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints)
          {
              const uint256& hash = i.second;
              std::map<uint256, CBlockIndex*>::const_iterator t = mapBlockIndex.find(hash);
              if (t != mapBlockIndex.end())
                  return t->second;
          }
          return NULL;
      }
  }