Skip to content

Commit 6dd8116

Browse files
committed
Remove SIGCHECK_VERIFICATION_FACTOR
1 parent 3641141 commit 6dd8116

File tree

3 files changed

+10
-32
lines changed

3 files changed

+10
-32
lines changed

src/validation.cpp

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4141,44 +4141,22 @@ void DumpMempool(void)
41414141
}
41424142
}
41434143

4144-
/**
4145-
* How many times slower we expect checking transactions after the last
4146-
* checkpoint to be (from checking signatures, which is skipped up to the
4147-
* last checkpoint). This number is a compromise, as it can't be accurate
4148-
* for every system. When reindexing from a fast disk with a slow CPU, it
4149-
* can be up to 20, while when downloading from a slow network with a
4150-
* fast multicore CPU, it won't be much higher than 1.
4151-
*/
4152-
static const double SIGCHECK_VERIFICATION_FACTOR = 5.0;
4153-
41544144
//! Guess how far we are in the verification process at the given block index
4155-
double GuessVerificationProgress(const ChainTxData& data, CBlockIndex *pindex, bool fSigchecks) {
4156-
if (pindex==NULL)
4145+
double GuessVerificationProgress(const ChainTxData& data, CBlockIndex *pindex) {
4146+
if (pindex == NULL)
41574147
return 0.0;
41584148

41594149
int64_t nNow = time(NULL);
41604150

4161-
double fSigcheckVerificationFactor = fSigchecks ? SIGCHECK_VERIFICATION_FACTOR : 1.0;
4162-
double fWorkBefore = 0.0; // Amount of work done before pindex
4163-
double fWorkAfter = 0.0; // Amount of work left after pindex (estimated)
4164-
// Work is defined as: 1.0 per transaction before the last checkpoint, and
4165-
// fSigcheckVerificationFactor per transaction after.
4151+
double fTxTotal;
41664152

41674153
if (pindex->nChainTx <= data.nTransactionsLastCheckpoint) {
4168-
double nCheapBefore = pindex->nChainTx;
4169-
double nCheapAfter = data.nTransactionsLastCheckpoint - pindex->nChainTx;
4170-
double nExpensiveAfter = (nNow - data.nTimeLastCheckpoint)/86400.0*data.fTransactionsPerDay;
4171-
fWorkBefore = nCheapBefore;
4172-
fWorkAfter = nCheapAfter + nExpensiveAfter*fSigcheckVerificationFactor;
4154+
fTxTotal = data.nTransactionsLastCheckpoint + (nNow - data.nTimeLastCheckpoint) / 86400.0 * data.fTransactionsPerDay;
41734155
} else {
4174-
double nCheapBefore = data.nTransactionsLastCheckpoint;
4175-
double nExpensiveBefore = pindex->nChainTx - data.nTransactionsLastCheckpoint;
4176-
double nExpensiveAfter = (nNow - pindex->GetBlockTime())/86400.0*data.fTransactionsPerDay;
4177-
fWorkBefore = nCheapBefore + nExpensiveBefore*fSigcheckVerificationFactor;
4178-
fWorkAfter = nExpensiveAfter*fSigcheckVerificationFactor;
4156+
fTxTotal = pindex->nChainTx + (nNow - pindex->GetBlockTime()) / 86400.0 * data.fTransactionsPerDay;
41794157
}
41804158

4181-
return fWorkBefore / (fWorkBefore + fWorkAfter);
4159+
return pindex->nChainTx / fTxTotal;
41824160
}
41834161

41844162
class CMainCleanup

src/validation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ bool ActivateBestChain(CValidationState& state, const CChainParams& chainparams,
281281
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
282282

283283
/** Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). */
284-
double GuessVerificationProgress(const ChainTxData& data, CBlockIndex* pindex, bool fSigchecks = true);
284+
double GuessVerificationProgress(const ChainTxData& data, CBlockIndex* pindex);
285285

286286
/**
287287
* Prune block and undo files (blk???.dat and undo???.dat) so that the disk space used is less than a user-defined target.

src/wallet/wallet.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,12 +1479,12 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
14791479
pindex = chainActive.Next(pindex);
14801480

14811481
ShowProgress(_("Rescanning..."), 0); // show rescan progress in GUI as dialog or on splashscreen, if -rescan on startup
1482-
double dProgressStart = GuessVerificationProgress(chainParams.TxData(), pindex, false);
1483-
double dProgressTip = GuessVerificationProgress(chainParams.TxData(), chainActive.Tip(), false);
1482+
double dProgressStart = GuessVerificationProgress(chainParams.TxData(), pindex);
1483+
double dProgressTip = GuessVerificationProgress(chainParams.TxData(), chainActive.Tip());
14841484
while (pindex)
14851485
{
14861486
if (pindex->nHeight % 100 == 0 && dProgressTip - dProgressStart > 0.0)
1487-
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((GuessVerificationProgress(chainParams.TxData(), pindex, false) - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
1487+
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((GuessVerificationProgress(chainParams.TxData(), pindex) - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
14881488

14891489
CBlock block;
14901490
ReadBlockFromDisk(block, pindex, Params().GetConsensus());

0 commit comments

Comments
 (0)