15 #include <boost/foreach.hpp> 34 int64_t nNow = time(NULL);
37 double fWorkBefore = 0.0;
38 double fWorkAfter = 0.0;
42 if (pindex->
nChainTx <=
data.nTransactionsLastCheckpoint) {
43 double nCheapBefore = pindex->
nChainTx;
44 double nCheapAfter =
data.nTransactionsLastCheckpoint - pindex->
nChainTx;
45 double nExpensiveAfter = (nNow -
data.nTimeLastCheckpoint)/86400.0*
data.fTransactionsPerDay;
46 fWorkBefore = nCheapBefore;
47 fWorkAfter = nCheapAfter + nExpensiveAfter*fSigcheckVerificationFactor;
49 double nCheapBefore =
data.nTransactionsLastCheckpoint;
50 double nExpensiveBefore = pindex->
nChainTx -
data.nTransactionsLastCheckpoint;
51 double nExpensiveAfter = (nNow - pindex->
GetBlockTime())/86400.0*
data.fTransactionsPerDay;
52 fWorkBefore = nCheapBefore + nExpensiveBefore*fSigcheckVerificationFactor;
53 fWorkAfter = nExpensiveAfter*fSigcheckVerificationFactor;
56 return fWorkBefore / (fWorkBefore + fWorkAfter);
63 BOOST_REVERSE_FOREACH(
const MapCheckpoints::value_type& i, checkpoints)
std::map< int, uint256 > MapCheckpoints
CBlockIndex * GetLastCheckpoint(const CCheckpointData &data)
Returns last CBlockIndex* in mapBlockIndex that is a checkpoint.
static const double SIGCHECK_VERIFICATION_FACTOR
double GuessVerificationProgress(const CCheckpointData &data, CBlockIndex *pindex, bool fSigchecks)
Guess how far we are in the verification process at the given block index.
int64_t GetBlockTime() const