src/checkpoints.cpp
// Guess how far we are in the verification process at the given block index
Guess how far we are in the verification process at the given block index
Guess how far we are in the verification process at the given block index
double GuessVerificationProgress(CBlockIndex *pindex) {
        if (pindex==NULL)
            return 0.0;
        int64_t nNow = time(NULL);
        double fWorkBefore = 0.0; 
        double fWorkAfter = 0.0;  
        const CCheckpointData &data = Checkpoints();
        if (pindex->nChainTx <= data.nTransactionsLastCheckpoint) {
            double nCheapBefore = pindex->nChainTx;
            double nCheapAfter = data.nTransactionsLastCheckpoint - pindex->nChainTx;
            double nExpensiveAfter = (nNow - data.nTimeLastCheckpoint)/86400.0*data.fTransactionsPerDay;
            fWorkBefore = nCheapBefore;
            fWorkAfter = nCheapAfter + nExpensiveAfter*fSigcheckVerificationFactor;
        } else {
            double nCheapBefore = data.nTransactionsLastCheckpoint;
            double nExpensiveBefore = pindex->nChainTx - data.nTransactionsLastCheckpoint;
            double nExpensiveAfter = (nNow - pindex->nTime)/86400.0*data.fTransactionsPerDay;
            fWorkBefore = nCheapBefore + nExpensiveBefore*fSigcheckVerificationFactor;
            fWorkAfter = nExpensiveAfter*fSigcheckVerificationFactor;
        }
        return fWorkBefore / (fWorkBefore + fWorkAfter);
    }
double GuessVerificationProgress ( CBlockIndex * pindex ) { if ( pindex == NULL ) return 0.0 ; int64_t nNow = time ( NULL ) ; double fWorkBefore = 0.0 ; double fWorkAfter = 0.0 ; const CCheckpointData & data = Checkpoints ( ) ; if ( pindex -> nChainTx <= data . nTransactionsLastCheckpoint ) { double nCheapBefore = pindex -> nChainTx ; double nCheapAfter = data . nTransactionsLastCheckpoint - pindex -> nChainTx ; double nExpensiveAfter = ( nNow - data . nTimeLastCheckpoint ) / 86400.0 * data . fTransactionsPerDay ; fWorkBefore = nCheapBefore ; fWorkAfter = nCheapAfter + nExpensiveAfter * fSigcheckVerificationFactor ; } else { double nCheapBefore = data . nTransactionsLastCheckpoint ; double nExpensiveBefore = pindex -> nChainTx - data . nTransactionsLastCheckpoint ; double nExpensiveAfter = ( nNow - pindex -> nTime ) / 86400.0 * data . fTransactionsPerDay ; fWorkBefore = nCheapBefore + nExpensiveBefore * fSigcheckVerificationFactor ; fWorkAfter = nExpensiveAfter * fSigcheckVerificationFactor ; } return fWorkBefore / ( fWorkBefore + fWorkAfter ) ; }
Guess how far we are in the verification process at the given block index
Guess how far we are in the verification process at the given block index
// Amount of work done before pindex // Amount of work left after pindex (estimated) // Work is defined as: 1.0 per transaction before the last checkpoint, and // fSigcheckVerificationFactor per transaction after.