diff options
| author | Pieter Wuille <[email protected]> | 2011-04-13 16:16:30 +0200 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2011-04-18 17:37:47 -0400 |
| commit | 6a76c60e6c4c21c6355c5580f9f770fcc9f978ef (patch) | |
| tree | ba3522df13633aeedf795b1bf967aa4f627ab584 /main.cpp | |
| parent | Merge branch 'upnpfix' of https://github.com/TheBlueMatt/bitcoin (diff) | |
| download | discoin-6a76c60e6c4c21c6355c5580f9f770fcc9f978ef.tar.xz discoin-6a76c60e6c4c21c6355c5580f9f770fcc9f978ef.zip | |
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.
Diffstat (limited to 'main.cpp')
| -rw-r--r-- | main.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1611,6 +1611,15 @@ bool CBlock::SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew) } } + // Update best block in wallet (so we can detect restored wallets) + if (!IsInitialBlockDownload()) + { + CWalletDB walletdb; + const CBlockLocator locator(pindexNew); + if (!walletdb.WriteBestBlock(locator)) + return error("SetBestChain() : WriteWalletBest failed"); + } + // New best block hashBestChain = hash; pindexBest = pindexNew; |