mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-23 21:34:45 +00:00
Bugfix: if no bestblock record is present, do a -rescan
It is possible to have a wallet.dat file without any bestblock record at all (if created offline, for example), which - when loaded into a client with a up-to-date chain - does no rescan and shows no transactions. Also make sure to write the current best block after a rescan, so it isn't necessary twice.
This commit is contained in:
parent
eef2091fe9
commit
2aceeb01a9
@ -988,6 +988,8 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||||||
CBlockLocator locator;
|
CBlockLocator locator;
|
||||||
if (walletdb.ReadBestBlock(locator))
|
if (walletdb.ReadBestBlock(locator))
|
||||||
pindexRescan = locator.GetBlockIndex();
|
pindexRescan = locator.GetBlockIndex();
|
||||||
|
else
|
||||||
|
pindexRescan = pindexGenesisBlock;
|
||||||
}
|
}
|
||||||
if (pindexBest && pindexBest != pindexRescan)
|
if (pindexBest && pindexBest != pindexRescan)
|
||||||
{
|
{
|
||||||
@ -996,6 +998,8 @@ bool AppInit2(boost::thread_group& threadGroup)
|
|||||||
nStart = GetTimeMillis();
|
nStart = GetTimeMillis();
|
||||||
pwalletMain->ScanForWalletTransactions(pindexRescan, true);
|
pwalletMain->ScanForWalletTransactions(pindexRescan, true);
|
||||||
printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
printf(" rescan %15"PRI64d"ms\n", GetTimeMillis() - nStart);
|
||||||
|
pwalletMain->SetBestChain(CBlockLocator(pindexBest));
|
||||||
|
nWalletDBUpdated++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ********************************************************* Step 9: import blocks
|
// ********************************************************* Step 9: import blocks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user