Information about the best known chain is added to wallet.dat. If this information does not match the data in blkindex.dat, a rescan is automatically performed at startup, starting from the the last known block. When upgrading from a wallet which does not have this information, no rescan is done automatically.
Automatically rescan after restoring wallet.dat #152
pull sipa wants to merge 1 commits into bitcoin:master from sipa:autorescan changing 3 files +33 −1-
sipa commented at 2:22 PM on April 13, 2011: member
-
sipa commented at 2:25 PM on April 13, 2011: member
One thing I did not test, is the slowdown. Continuously creating CBlockLocator's and writing them to wallet.dat may slow down initial block download.
-
gavinandresen commented at 2:43 PM on April 13, 2011: contributor
Nice! RE: block download speed: I'd suggest a check for if IsInitialBlockDownload() and don't bother writing best-block-index during the initial block download.
-
sipa commented at 3:33 PM on April 13, 2011: member
Ok, updated.
-
gavinandresen commented at 4:07 PM on April 15, 2011: contributor
Looking at this again and thinking about pulling, it seems more complicated than it needs to be-- CBlockLocator can already serialize/deserialize itself, is there a reason for the ReadBestBlock/WriteBestBlock methods? Why not just Read/Write the CBlockLocator instead of CBLockLocator.vHave?
-
4f40b0922e
Automatically rescan after restoring wallet.dat
Information about the best known chain is added to wallet.dat. If this information does not match the data in blkindex.dat, a rescan is automatically performed, starting from the the last known block. When upgrading from a wallet which does not have this information, no rescan is done automatically.
-
sipa commented at 5:38 PM on April 17, 2011: member
I didn't realize db.h did define classes from main.h as well, to use them. I added CBlockLocator to those and simplified the patch.
-
gavinandresen commented at 3:35 PM on April 20, 2011: contributor
Pulled via cherry-pick.
- gavinandresen closed this on Apr 20, 2011
- dexX7 referenced this in commit fd39ee201f on Jul 29, 2015
- ptschip referenced this in commit 89de418155 on Nov 9, 2016
- destenson referenced this in commit 3679a8c02e on Nov 18, 2017
- lateminer referenced this in commit d6b4cdddf8 on Dec 9, 2017
- classesjack referenced this in commit dedd98b2c3 on Jan 2, 2018
- cryptapus referenced this in commit f11c553c13 on May 6, 2019
- attilaaf referenced this in commit 71f9eddb0d on Jan 13, 2020
- rajarshimaitra referenced this in commit d89ee86603 on Mar 23, 2021
- cryptapus referenced this in commit a8ad5a92fd on May 3, 2021
- DrahtBot locked this on Sep 8, 2021