X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fcheckpoints.cpp;h=2a2638844a3048b5fa007eab2f14484e8e333c0c;hb=3176e0f244d929669aa3e1d81e0787d82d9150d3;hp=80f6db6dce18a0fc4af76a1b401ceb52179d25df;hpb=83e34b29071b58d6578b197430d12c55d277a515;p=novacoin.git diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index 80f6db6..2a26388 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -1,5 +1,6 @@ // Copyright (c) 2009-2012 The Bitcoin developers -// Copyright (c) 2011-2012 The PPCoin developers +// Copyright (c) 2011-2013 The PPCoin developers +// Copyright (c) 2013 NovaCoin Developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -26,7 +27,7 @@ namespace Checkpoints static MapCheckpoints mapCheckpoints = boost::assign::map_list_of ( 0, hashGenesisBlockOfficial ) - ; // ppcoin: no checkpoint yet; to be created in future releases + ; bool CheckHardened(int nHeight, const uint256& hash) { @@ -351,6 +352,16 @@ namespace Checkpoints return (nBestHeight >= pindexSync->nHeight + nCoinbaseMaturity || pindexSync->GetBlockTime() + nStakeMinAge < GetAdjustedTime()); } + + // Is the sync-checkpoint too old? + bool IsSyncCheckpointTooOld(unsigned int nSeconds) + { + LOCK(cs_hashSyncCheckpoint); + // sync-checkpoint should always be accepted block + assert(mapBlockIndex.count(hashSyncCheckpoint)); + const CBlockIndex* pindexSync = mapBlockIndex[hashSyncCheckpoint]; + return (pindexSync->GetBlockTime() + nSeconds < GetAdjustedTime()); + } } // ppcoin: sync-checkpoint master key