X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fcheckpoints.cpp;h=ee74d2593023e5e9ac546133c83fe6b7342d382e;hb=d11488abd05cb39a9f481e7c4c35f780197a3d28;hp=4419a06c83099c52f237f0833c1e5c463d68b858;hpb=d27be1f55777bd502beb6b89513f1a03ed988f1a;p=novacoin.git diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index 4419a06..ee74d25 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -1,17 +1,24 @@ -// Copyright (c) 2011 The Bitcoin developers +// Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying -// file license.txt or http://www.opensource.org/licenses/mit-license.php. - -#include "checkpoints.h" -#include "uint256.h" -#include "util.h" +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include // for 'map_list_of()' +#include + +#include "headers.h" +#include "checkpoints.h" namespace Checkpoints { typedef std::map 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 ( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d")) @@ -23,6 +30,7 @@ namespace Checkpoints (118000, uint256("0x000000000000774a7f8a7a12dc906ddb9e17e75d684f15e00f8767f9e8f36553")) (134444, uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe")) (140700, uint256("0x000000000000033b512028abb90e1626d8b346fd0ed598ac0a3c371138dce2bd")) + (168000, uint256("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763")) ; bool CheckBlock(int nHeight, const uint256& hash) @@ -36,8 +44,22 @@ namespace Checkpoints int GetTotalBlocksEstimate() { - if (fTestNet) return 0; // Testnet has no checkpoints + if (fTestNet) return 0; return mapCheckpoints.rbegin()->first; } + + CBlockIndex* GetLastCheckpoint(const std::map& mapBlockIndex) + { + if (fTestNet) return NULL; + + BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints) + { + const uint256& hash = i.second; + std::map::const_iterator t = mapBlockIndex.find(hash); + if (t != mapBlockIndex.end()) + return t->second; + } + return NULL; + } }