aboutsummaryrefslogtreecommitdiff
path: root/src/checkpoints.cpp
diff options
context:
space:
mode:
authorGiel van Schijndel <[email protected]>2012-06-17 14:30:37 +0200
committerGiel van Schijndel <[email protected]>2012-06-17 14:30:37 +0200
commit07368a9e3c60bbef8452501d34bb8d3688cbca13 (patch)
tree963f2e56176451bfeb84e54d14bf726388407b7d /src/checkpoints.cpp
parentUse the QueueShutdown signal to stop accepting new RPC connections (diff)
parentDocument how to build/run unit tests (diff)
downloaddiscoin-07368a9e3c60bbef8452501d34bb8d3688cbca13.tar.xz
discoin-07368a9e3c60bbef8452501d34bb8d3688cbca13.zip
Merge branch 'master' into async-ipv6-rpc
Conflicts: src/bitcoinrpc.cpp Signed-off-by: Giel van Schijndel <[email protected]>
Diffstat (limited to 'src/checkpoints.cpp')
-rw-r--r--src/checkpoints.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp
index 6679bc93d..6f7a92bb2 100644
--- a/src/checkpoints.cpp
+++ b/src/checkpoints.cpp
@@ -35,27 +35,32 @@ namespace Checkpoints
(168000, uint256("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763"))
;
+ static MapCheckpoints mapCheckpointsTestnet =
+ boost::assign::map_list_of
+ ( 546, uint256("000000002a936ca763904c3c35fce2f3556c559c0214345d31b1bcebf76acb70"))
+ ;
+
bool CheckBlock(int nHeight, const uint256& hash)
{
- if (fTestNet) return true; // Testnet has no checkpoints
+ MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
- MapCheckpoints::const_iterator i = mapCheckpoints.find(nHeight);
- if (i == mapCheckpoints.end()) return true;
+ MapCheckpoints::const_iterator i = checkpoints.find(nHeight);
+ if (i == checkpoints.end()) return true;
return hash == i->second;
}
int GetTotalBlocksEstimate()
{
- if (fTestNet) return 0;
+ MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
- return mapCheckpoints.rbegin()->first;
+ return checkpoints.rbegin()->first;
}
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
{
- if (fTestNet) return NULL;
+ MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints);
- BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, 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);