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
  1. yakitorifoodie commented at 5:38 pm on May 18, 2020: none

    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.

  2. 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.
    9ac7e69c92
  3. 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 to 10 when nCheckDepth is less than 1000 blocks and to 1 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.
  4. DrahtBot added the label Validation on May 18, 2020
  5. MarcoFalke added the label Waiting for author on May 26, 2020
  6. Update validation.cpp
    report every 10% step if nCheckDepth is <= 1000 blocks else report every 1% step.
    06cd245eed
  7. MarcoFalke removed the label Waiting for author on May 26, 2020
  8. in 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 notes
  9. MarcoFalke commented at 12:54 pm on May 26, 2020: member
  10. Update src/validation.cpp
    Co-authored-by: MarcoFalke <falke.marco@gmail.com>
    cf54f1c7b9
  11. Update validation.cpp 97056ac2bf
  12. adamjonas commented at 3:35 pm on June 11, 2020: member
    Hi @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.
  13. 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 initialize log_step.
  14. 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) {
    
  15. 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;
    
  16. 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) {
    
  17. 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;
    
  18. jonatack commented at 3:58 pm on June 11, 2020: member

    Concept ACK

    A few formatting nits while retouching to squash the commits.

  19. Update src/validation.cpp
    Co-authored-by: Jon Atack <jon@atack.com>
    d3df4400f0
  20. Update src/validation.cpp
    Co-authored-by: Jon Atack <jon@atack.com>
    5a84237774
  21. Update src/validation.cpp
    Co-authored-by: Jon Atack <jon@atack.com>
    a5ba691d98
  22. Update src/validation.cpp
    Co-authored-by: Jon Atack <jon@atack.com>
    0eb0fc438c
  23. DrahtBot commented at 11:04 pm on August 1, 2020: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    No conflicts as of last run.

  24. 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.
  25. MarcoFalke commented at 6:27 pm on August 27, 2020: member
    Are you still working on this. Otherwise I suggest closing “Up for grabs”
  26. fanquake added the label Up for grabs on Aug 28, 2020
  27. fanquake commented at 0:56 am on August 28, 2020: member
    This can be re-opened if needed.
  28. fanquake closed this on Aug 28, 2020

  29. 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