[Qt] rescan progress #3928

pull cozz wants to merge 1 commits into bitcoin:master from cozz:cozz7 changing 10 files +113 −9
  1. cozz commented at 3:50 PM on March 21, 2014: contributor

    Fixes #3832. If -rescan on startup, show progress in splashscreen, else show progress dialog.

    Needed to implement a temporary notifications queue, otherwise the notifications get queued and block the ui from updating the progress dialog.

    Tested linux only qt4 and qt5.

    rescan2

    rescan

  2. in src/wallet.cpp:None in e638653ad4 outdated
     841 | +            if (pindex->nHeight % 100 == 0)
     842 | +            {
     843 | +                // show progress on splashscreen, if -rescan on startup
     844 | +                uiInterface.SplashMessage(_("Rescanning...") + strprintf("%d", (int)(Checkpoints::GuessVerificationProgress(pindex) * 100)) + "%");
     845 | +
     846 | +                // update progress dialog in GUI
    


    laanwj commented at 4:14 PM on March 21, 2014:

    Thanks for tackling this!

    Nit: We should use the same ShowProgress in the splash screen, and avoid SplashMessage (which burdens the interface as it's basically just a copy of InitMessage) and the resulting duplication here.


    laanwj commented at 4:49 PM on March 21, 2014:

    I thought about that a bit and it will indeed give an implementation difficulty: how to get the SplashScreen to subscribe to the wallet in Init to get updates? Maybe add a uiInterface signal to announce a new CWallet to the GUI? Seems something we'll need eventually for MultiWallet support anyway.

  3. in src/qt/walletmodel.h:None in e638653ad4 outdated
     210 | @@ -210,6 +211,7 @@ class WalletModel : public QObject
     211 |      EncryptionStatus cachedEncryptionStatus;
     212 |      int cachedNumBlocks;
     213 |  
     214 | +    QProgressDialog *progressDialog;
    


    laanwj commented at 4:46 PM on March 21, 2014:

    This dialog should be in the wallet view, not the model :)

  4. cozz commented at 11:19 PM on March 21, 2014: contributor

    update:

    • removed SplashMessage signal, now only 1 signal in CWallet::ScanForWalletTransactions
    • added LoadWallet signal to uiInterface
    • moved QProgressDialog to walletview
  5. laanwj commented at 10:29 AM on March 23, 2014: member

    ACK on code changes Still need to test

  6. laanwj commented at 11:34 AM on March 24, 2014: member

    Testing: With a fairly new wallet it goes from 1% to 2% then is finished. My guess is that progress reporting is not correct when not starting from the beginning?

  7. cozz commented at 12:36 PM on March 24, 2014: contributor

    I assume you have only downloaded 2% of the chain? In this case, rescan is finished after 2% yes. If not started from the beginning it should go to, lets say 98% pretty fast, and then scan the other 2% (assuming you are 100% synced).

    #3696 introduced Checkpoints::GuessVerificationProgress for calculating the progress. so I just used it and didnt think about it any further. Checkpoints::GuessVerificationProgress takes fSigcheckVerificationFactor into account and shows the progress of syncing. It does not always work for rescan.

    So I suggest writing a Checkpoints::GuessRescanProgress instead: Similar to GuessVerificationProgress, but:

    • consider that we may not be 100% synced
    • consider that rescan can skip blocks from the beginning
    • ignore fSigcheckVerificationFactor, but still consider that early blocks are faster to rescan, because less transactions

    Or extend Checkpoints::GuessVerificationProgress with optional parameters, if possible.

  8. sipa commented at 12:39 PM on March 24, 2014: member

    For rscan progress, I think you can just use (GuessProgress(current) - GuessProgress(start)) / (GuessProgress(tip) - GuessProgress(start))?

  9. laanwj commented at 12:42 PM on March 24, 2014: member

    I have downloaded the entire chain. It just doesn't start the rescan from the beginning because the wallet birthdate is recent.

  10. cozz commented at 1:23 PM on March 24, 2014: contributor

    @sipa great idea, thanks. @laanwj To be honest, not sure how rescan can be finished after 2%, if you are synced. Even if blocks are skipped at the beginning, GuessVerificationProgress doesnt care about that.

    Looks like this needs better testing of all the edge cases. I will

    • add an optional boolean parameter fIgnoreSigchecks to GuessVerificationProgress
    • implement @sipa formula
    • do some more testing and push an update
  11. laanwj commented at 1:35 PM on March 24, 2014: member

    @cozz I see. Yes, I have the full blockchain but it had started a reindex. So it makes sense that it stops at 2%, because it only had come that far with reindexing. False alarm.

  12. cozz commented at 1:41 PM on March 24, 2014: contributor

    @laanwj Ok. Still makes sense to consider skipped blocks at beginning or end for progress.

  13. laanwj commented at 9:53 AM on March 28, 2014: member

    @cozz you're going to do those changes inside this pull request?

  14. cozz commented at 12:06 AM on March 30, 2014: contributor

    update:

    • added bool fSigchecks to Checkpoints::GuessVerificationProgress(..)
    • consider dPrgressStart and dPrgressTip in progress calculation in CWallet::ScanForWalletTransactions(..)
  15. sipa commented at 3:08 PM on March 30, 2014: member

    ACK core changes; didn't test.

  16. [Qt] rescan progress 392783697c
  17. in src/qt/splashscreen.cpp:None in 311480666c outdated
       4 | @@ -5,8 +5,10 @@
       5 |  #include "splashscreen.h"
       6 |  
       7 |  #include "clientversion.h"
       8 | +#include "init.h"
       9 |  #include "ui_interface.h"
      10 |  #include "util.h"
      11 | +#include "wallet.h"
    


    laanwj commented at 6:47 AM on March 31, 2014:

    This include needs to be in #ifdef ENABLE_WALLET

  18. cozz commented at 1:51 AM on April 2, 2014: contributor

    update:

    • added #ifdef around #include "wallet.h"
  19. BitcoinPullTester commented at 4:12 AM on April 2, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/392783697c21a0c4cf3db6b0946d3d44d7fed537 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  20. laanwj commented at 9:46 AM on April 3, 2014: member

    Works for me. Thanks for implementing this @cozz

  21. laanwj referenced this in commit 9bd1bdd08c on Apr 3, 2014
  22. laanwj merged this on Apr 3, 2014
  23. laanwj closed this on Apr 3, 2014

  24. Diapolo commented at 8:57 AM on April 4, 2014: none

    A comment, when I supply -rescan with Qt we can click the splashscreen and it fades (as it's an own thread now)... this will result in a tray-icon but NO further user feedback during re-scan. Perhaps it should show the progress via tray pop-up also?

    Btw. is there a RPC command to trigger a rescan during normal Qt runtime?

  25. laanwj commented at 9:34 AM on April 4, 2014: member

    Well if you don't want to see the splash screen, you also don't see the progress. I think that makes sense. I suppose a way to bring back the splash screen would be nice (for some reason it doesn't just minimize?) (see also #3282).

    Some OSes (Windows http://www.codeproject.com/Articles/37451/Display-Progress-and-Overlay-Icons-for-Multiple-Vi , Ubuntu https://wiki.ubuntu.com/Unity/LauncherAPI ) have a way to show progress for an application in the tray, that would makes sense in this case. However, this was very OS specific last time I looked at it, and would pull in new dependencies, so I didn't bother with it.

    Not sure what you mean, but just please do not abuse notification balloons for this.

    BTW: not that I know of, I'm triggering rescans by generating a private key on the testnet bitaddress.org and importing it.

  26. Diapolo commented at 9:49 AM on April 4, 2014: none

    When you click the splashscreen it's gone, no way to bring it back currently. Would be nice if a click on the tray icon could re-activate it.

  27. rebroad commented at 11:42 PM on May 15, 2014: contributor

    Given that ShowProgress() could also be used to show block verification progress in the splash screen, is it ideally placed in the wallet related cpp files?

  28. laanwj commented at 7:24 AM on May 16, 2014: member

    It is used in the splash screen to display progress. The methods are on the wallet because the progress is wallet-specific. In theory multiple wallets could be rescanning in parallel.

  29. DrahtBot locked this on Sep 8, 2021

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: 2026-04-13 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me