aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2017-01-04 13:09:20 -0800
committerPieter Wuille <pieter.wuille@gmail.com>2017-01-04 13:18:49 -0800
commit6dd81169fc33f0c9720afe0b9b52ed4539e59580 (patch)
treef243c60aefacfa18baea08ec7626b00c20a1ae0a /src/validation.cpp
parent3641141c8f9bdc68fcc0792ce8842a8e33ea7320 (diff)
Remove SIGCHECK_VERIFICATION_FACTOR
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp34
1 files changed, 6 insertions, 28 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 14d5dbe452..0ff9a00254 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -4141,44 +4141,22 @@ void DumpMempool(void)
}
}
-/**
- * How many times slower we expect checking transactions after the last
- * checkpoint to be (from checking signatures, which is skipped up to the
- * last checkpoint). This number is a compromise, as it can't be accurate
- * for every system. When reindexing from a fast disk with a slow CPU, it
- * can be up to 20, while when downloading from a slow network with a
- * fast multicore CPU, it won't be much higher than 1.
- */
-static const double SIGCHECK_VERIFICATION_FACTOR = 5.0;
-
//! Guess how far we are in the verification process at the given block index
-double GuessVerificationProgress(const ChainTxData& data, CBlockIndex *pindex, bool fSigchecks) {
- if (pindex==NULL)
+double GuessVerificationProgress(const ChainTxData& data, CBlockIndex *pindex) {
+ if (pindex == NULL)
return 0.0;
int64_t nNow = time(NULL);
- double fSigcheckVerificationFactor = fSigchecks ? SIGCHECK_VERIFICATION_FACTOR : 1.0;
- double fWorkBefore = 0.0; // Amount of work done before pindex
- double fWorkAfter = 0.0; // Amount of work left after pindex (estimated)
- // Work is defined as: 1.0 per transaction before the last checkpoint, and
- // fSigcheckVerificationFactor per transaction after.
+ double fTxTotal;
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;
+ fTxTotal = data.nTransactionsLastCheckpoint + (nNow - data.nTimeLastCheckpoint) / 86400.0 * data.fTransactionsPerDay;
} else {
- double nCheapBefore = data.nTransactionsLastCheckpoint;
- double nExpensiveBefore = pindex->nChainTx - data.nTransactionsLastCheckpoint;
- double nExpensiveAfter = (nNow - pindex->GetBlockTime())/86400.0*data.fTransactionsPerDay;
- fWorkBefore = nCheapBefore + nExpensiveBefore*fSigcheckVerificationFactor;
- fWorkAfter = nExpensiveAfter*fSigcheckVerificationFactor;
+ fTxTotal = pindex->nChainTx + (nNow - pindex->GetBlockTime()) / 86400.0 * data.fTransactionsPerDay;
}
- return fWorkBefore / (fWorkBefore + fWorkAfter);
+ return pindex->nChainTx / fTxTotal;
}
class CMainCleanup