Automate -rescan when reading wallet #99

issue gavinandresen opened this issue on March 5, 2011
  1. gavinandresen commented at 3:28 PM on March 5, 2011: contributor

    Good Idea from Mr. Nakamoto:

    Whenever a new block is accepted, the best block pointer is updated in blkindex.dat.  If you also record it in wallet.dat (as a CBlockLocator), then on startup, if wallet's last seen best block is further back than blkindex.dat's, it should rescan starting from there.

  2. tcatm commented at 4:24 PM on March 5, 2011: none

    Good idea. What happens when wallet's block is from an orphaned chain (chainsplit while wallet was closed)?

  3. gavinandresen commented at 5:08 PM on March 5, 2011: contributor

    CBlockLocator Does The Right Thing. Good idea to test that, though:

    • Test wallet.dat points to orphan block that IS in blkindex (should rescan starting at block split)
    • Test wallet.dat points to orphan block that IS NOT in blkindex (should do full rescan)

    Now we just need a good way of forcing chain splits / orphan blocks on the testnet...

  4. tcatm commented at 5:52 PM on March 5, 2011: none

    Forcing chain splits with two GPUs and -addnode/-connect/-nolisten magic should be easy. I can do that once we have a patch.

  5. sipa commented at 2:25 PM on April 13, 2011: member

    See #152

  6. alexgenaud commented at 4:38 PM on May 30, 2011: none

    Is -rescan needed because of Merkle tree pruning? Where I live disks are cheap but the network is prohibitively expense. Is it practical to optionally save the ENTIRE block chain and just look up my addresses in the full local table.

    Or similarly, is it possible to keep track of all addresses ever seen on a local machine and never prune those addresses, regardless of the 'current' wallet?

  7. sipa commented at 9:53 PM on May 30, 2011: member

    -rescan is to find transactions that are in your local copy of the block chain, but not in your wallet, yet should be.

  8. sipa commented at 9:53 PM on May 30, 2011: member

    Also, merged since 0.3.21.

  9. sipa closed this on May 30, 2011

  10. alexgenaud commented at 10:13 AM on May 31, 2011: none

    Tested on seven wallet.dat's that have not been opened in a week. Confirmed:

    1 That 0.3.21 does indeed rescan (without the -rescan flag)

    2 That each subsequently opened wallet requires little or no bandwidth

    3 Possible to open wallet and view balance without network connection

    As for # 3, I wonder if there should not be a message in the GUI indicating that the balance is accurate only as of some date and hint that an internet connection is required to get an up-to-date balance.

    • Note one week (May 2011) required almost 20MB of downstream bandwidth.
  11. glv2 referenced this in commit c2d0b7a2af on Apr 15, 2014
  12. zathras-crypto referenced this in commit ac4a070710 on Aug 27, 2014
  13. rdponticelli referenced this in commit 28515b8848 on Nov 26, 2014
  14. dexX7 referenced this in commit d4bbd9c690 on Jun 26, 2015
  15. MarcoFalke referenced this in commit a20610a746 on Mar 26, 2016
  16. ptschip referenced this in commit c77e4d2038 on Oct 24, 2016
  17. cryptapus referenced this in commit 452033d04b on Sep 24, 2018
  18. lateminer referenced this in commit 518aed17cc on Feb 23, 2019
  19. 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 21:16 UTC

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