src/checkpoints.cpp
// ppcoin: reset synchronized checkpoint to last hardened checkpoint
reset synchronized checkpoint to last hardened checkpoint
reset synchronized checkpoint to last hardened checkpoint
bool ResetSyncCheckpoint()
    {
        LOCK(cs_hashSyncCheckpoint);
        const uint256& hash = mapCheckpoints.rbegin()->second;
        if (mapBlockIndex.count(hash) && !mapBlockIndex[hash]->IsInMainChain())
        {
            LogPrintf("ResetSyncCheckpoint: SetBestChain to hardened checkpoint %s\n", hash.ToString().c_str());
            CTxDB txdb;
            CBlock block;
            if (!block.ReadFromDisk(mapBlockIndex[hash]))
                return error("ResetSyncCheckpoint: ReadFromDisk failed for hardened checkpoint %s", hash.ToString().c_str());
            if (!block.SetBestChain(txdb, mapBlockIndex[hash]))
            {
                return error("ResetSyncCheckpoint: SetBestChain failed for hardened checkpoint %s", hash.ToString().c_str());
            }
        }
        else if(!mapBlockIndex.count(hash))
        {
            hashPendingCheckpoint = hash;
            checkpointMessagePending.SetNull();
            LogPrintf("ResetSyncCheckpoint: pending for sync-checkpoint %s\n", hashPendingCheckpoint.ToString().c_str());
        }
        BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints)
        {
            const uint256& hash = i.second;
            if (mapBlockIndex.count(hash) && mapBlockIndex[hash]->IsInMainChain())
            {
                if (!WriteSyncCheckpoint(hash))
                    return error("ResetSyncCheckpoint: failed to write sync checkpoint %s", hash.ToString().c_str());
                LogPrintf("ResetSyncCheckpoint: sync-checkpoint reset to %s\n", hashSyncCheckpoint.ToString().c_str());
                return true;
            }
        }
        return false;
    }
bool ResetSyncCheckpoint ( ) { LOCK ( cs_hashSyncCheckpoint ) ; const uint256 & hash = mapCheckpoints . rbegin ( ) -> second ; if ( mapBlockIndex . count ( hash ) && ! mapBlockIndex [ hash ] -> IsInMainChain ( ) ) { LogPrintf ( " \n " , hash . ToString ( ) . c_str ( ) ) ; CTxDB txdb ; CBlock block ; if ( ! block . ReadFromDisk ( mapBlockIndex [ hash ] ) ) return error ( " " , hash . ToString ( ) . c_str ( ) ) ; if ( ! block . SetBestChain ( txdb , mapBlockIndex [ hash ] ) ) { return error ( " " , hash . ToString ( ) . c_str ( ) ) ; } } else if ( ! mapBlockIndex . count ( hash ) ) { hashPendingCheckpoint = hash ; checkpointMessagePending . SetNull ( ) ; LogPrintf ( " \n " , hashPendingCheckpoint . ToString ( ) . c_str ( ) ) ; } BOOST_REVERSE_FOREACH ( const MapCheckpoints :: value_type & i , mapCheckpoints ) { const uint256 & hash = i . second ; if ( mapBlockIndex . count ( hash ) && mapBlockIndex [ hash ] -> IsInMainChain ( ) ) { if ( ! WriteSyncCheckpoint ( hash ) ) return error ( " " , hash . ToString ( ) . c_str ( ) ) ; LogPrintf ( " \n " , hashSyncCheckpoint . ToString ( ) . c_str ( ) ) ; return true ; } } return false ; }
ppcoin: reset synchronized checkpoint to last hardened checkpoint
ppcoin : reset synchronized checkpoint to last hardened checkpoint
// checkpoint block accepted but not yet in main chain // checkpoint block not yet accepted