Currently “verifychain” prints progress every 10 steps. If a user tries to verify the whole blockchain (verifychain 4 0) it will take a lot of time and printing progress every 1 step is very useful.
Print “verifychain” progress every 1 step if user verifies whole blockchain. #19009
pull yakitorifoodie wants to merge 8 commits into bitcoin:master from yakitorifoodie:patch-3 changing 1 files +7 −6-
yakitorifoodie commented at 5:38 pm on May 18, 2020: none
-
Print "verifychain" progress every 1 step.
Currently "verifychain" prints every 10 steps. If a user tries to verify the whole blockchain (verifychain 4 0) it will take a lot of time and printing progress every 1 step is very useful.
-
in src/validation.cpp:4265 in 9ac7e69c92 outdated
4261@@ -4262,10 +4262,10 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview, 4262 for (pindex = ::ChainActive().Tip(); pindex && pindex->pprev; pindex = pindex->pprev) { 4263 boost::this_thread::interruption_point(); 4264 const int percentageDone = std::max(1, std::min(99, (int)(((double)(::ChainActive().Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100)))); 4265- if (reportDone < percentageDone/10) { 4266+ if (reportDone < percentageDone/1) {
MarcoFalke commented at 5:45 pm on May 18, 2020:Maybe extract this as a constant that is set to10
when nCheckDepth is less than 1000 blocks and to1
otherwise?
laanwj commented at 11:05 am on May 26, 2020:I agree with @MarcoFalke.
yakitorifoodie commented at 12:52 pm on May 26, 2020:@MarcoFalke @laanwj Done. Thank you.DrahtBot added the label Validation on May 18, 2020MarcoFalke added the label Waiting for author on May 26, 2020Update validation.cpp
report every 10% step if nCheckDepth is <= 1000 blocks else report every 1% step.
MarcoFalke removed the label Waiting for author on May 26, 2020in src/validation.cpp:4262 in 06cd245eed outdated
4257@@ -4258,14 +4258,16 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview, 4258 int nGoodTransactions = 0; 4259 BlockValidationState state; 4260 int reportDone = 0; 4261+ int logStep; 4262+ logStep = nCheckDepth > 1000 ? 1 : 10;
MarcoFalke commented at 12:54 pm on May 26, 2020:0 const int log_step{nCheckDepth > 1000 ? 1 : 10};
MarcoFalke commented at 12:54 pm on May 26, 2020:According to the dev notesMarcoFalke commented at 12:54 pm on May 26, 2020: memberPlease squash your commits according to https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commitsUpdate src/validation.cpp
Co-authored-by: MarcoFalke <falke.marco@gmail.com>
Update validation.cpp 97056ac2bfadamjonas commented at 3:35 pm on June 11, 2020: memberHi @yakitorifoodie, nice to see you contributing for the first time! Pinging you on the squash requested above. You’ll need to do that before this can be merged.in src/validation.cpp:4261 in 97056ac2bf outdated
4257@@ -4258,14 +4258,15 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview, 4258 int nGoodTransactions = 0; 4259 BlockValidationState state; 4260 int reportDone = 0; 4261+ const int log_step{nCheckDepth > 1000 ? 1 : 10};
jonatack commented at 3:55 pm on June 11, 2020:Perhaps place the explanatory comment of// report every 10% step if nCheckDepth is <= 1000 blocks else report every 1% step
here where you initializelog_step
.in src/validation.cpp:4266 in 97056ac2bf outdated
4263 for (pindex = ::ChainActive().Tip(); pindex && pindex->pprev; pindex = pindex->pprev) { 4264 boost::this_thread::interruption_point(); 4265 const int percentageDone = std::max(1, std::min(99, (int)(((double)(::ChainActive().Height() - pindex->nHeight)) / (double)nCheckDepth * (nCheckLevel >= 4 ? 50 : 100)))); 4266- if (reportDone < percentageDone/10) { 4267- // report every 10% step 4268+ if (reportDone < percentageDone/log_step) {
jonatack commented at 3:55 pm on June 11, 2020:0 if (reportDone < percentageDone / log_step) {
in src/validation.cpp:4269 in 97056ac2bf outdated
4267- // report every 10% step 4268+ if (reportDone < percentageDone/log_step) { 4269+ // report every 10% step if nCheckDepth is <= 1000 blocks else report every 1% step. 4270 LogPrintf("[%d%%]...", percentageDone); /* Continued */ 4271- reportDone = percentageDone/10; 4272+ reportDone = percentageDone/log_step;
jonatack commented at 3:56 pm on June 11, 2020:0 reportDone = percentageDone / log_step;
in src/validation.cpp:4324 in 97056ac2bf outdated
4320@@ -4320,10 +4321,10 @@ bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview, 4321 while (pindex != ::ChainActive().Tip()) { 4322 boost::this_thread::interruption_point(); 4323 const int percentageDone = std::max(1, std::min(99, 100 - (int)(((double)(::ChainActive().Height() - pindex->nHeight)) / (double)nCheckDepth * 50))); 4324- if (reportDone < percentageDone/10) { 4325- // report every 10% step 4326+ if (reportDone < percentageDone/log_step) {
jonatack commented at 3:56 pm on June 11, 2020:0 if (reportDone < percentageDone / log_step) {
in src/validation.cpp:4327 in 97056ac2bf outdated
4325- // report every 10% step 4326+ if (reportDone < percentageDone/log_step) { 4327+ // report every 10% step if nCheckDepth is <= 1000 blocks else report every 1% step. 4328 LogPrintf("[%d%%]...", percentageDone); /* Continued */ 4329- reportDone = percentageDone/10; 4330+ reportDone = percentageDone/log_step;
jonatack commented at 3:56 pm on June 11, 2020:0 reportDone = percentageDone / log_step;
jonatack commented at 3:58 pm on June 11, 2020: memberConcept ACK
A few formatting nits while retouching to squash the commits.
Update src/validation.cpp
Co-authored-by: Jon Atack <jon@atack.com>
Update src/validation.cpp
Co-authored-by: Jon Atack <jon@atack.com>
Update src/validation.cpp
Co-authored-by: Jon Atack <jon@atack.com>
Update src/validation.cpp
Co-authored-by: Jon Atack <jon@atack.com>
DrahtBot commented at 11:04 pm on August 1, 2020: memberThe following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
No conflicts as of last run.
adamjonas commented at 10:12 pm on August 13, 2020: member@yakitorifoodie - let me know if you’d like a hand with squashing your commits. I’m ajonas on IRC or you can email me at jonas at chaincode.com if you want to talk through it.MarcoFalke commented at 6:27 pm on August 27, 2020: memberAre you still working on this. Otherwise I suggest closing “Up for grabs”fanquake added the label Up for grabs on Aug 28, 2020fanquake commented at 0:56 am on August 28, 2020: memberThis can be re-opened if needed.fanquake closed this on Aug 28, 2020
DrahtBot locked this on Feb 15, 2022
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-21 15:12 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me