aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-05-03 14:08:46 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2013-05-03 14:08:46 -0700
commitaa6b3061ee59b8c4d962097118298bafbd080c18 (patch)
tree362a4b6f5f682c5f6443f9dbb8a1c0020f81f26d
parent26585c36b260c045e6513c2f5038258d0bdababd (diff)
parent2aceeb01a9b0b0c6bfa0d56211453e87bc33d6e4 (diff)
Merge pull request #2603 from sipa/nobestblock
Bugfix: if no bestblock record is present, do a -rescan
-rw-r--r--src/init.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/init.cpp b/src/init.cpp
index d82afd7123..ea380f5a46 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -987,6 +987,8 @@ bool AppInit2(boost::thread_group& threadGroup)
CBlockLocator locator;
if (walletdb.ReadBestBlock(locator))
pindexRescan = locator.GetBlockIndex();
+ else
+ pindexRescan = pindexGenesisBlock;
}
if (pindexBest && pindexBest != pindexRescan)
{
@@ -995,6 +997,8 @@ bool AppInit2(boost::thread_group& threadGroup)
nStart = GetTimeMillis();
pwalletMain->ScanForWalletTransactions(pindexRescan, true);
printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart);
+ pwalletMain->SetBestChain(CBlockLocator(pindexBest));
+ nWalletDBUpdated++;
}
// ********************************************************* Step 9: import blocks