Merge pull request #2682 from sipa/morewalletbb

More bestblock records in wallets
This commit is contained in:
Gregory Maxwell 2013-05-22 14:01:31 -07:00
commit 95c2ba1689
2 changed files with 4 additions and 1 deletions

View File

@ -100,6 +100,7 @@ void Shutdown()
StopNode();
{
LOCK(cs_main);
pwalletMain->SetBestChain(CBlockLocator(pindexBest));
if (pblocktree)
pblocktree->Flush();
if (pcoinsTip)
@ -998,6 +999,8 @@ bool AppInit2(boost::thread_group& threadGroup)
if (!pwalletMain->SetAddressBookName(pwalletMain->vchDefaultKey.GetID(), ""))
strErrors << _("Cannot write default address") << "\n";
}
pwalletMain->SetBestChain(CBlockLocator(pindexBest));
}
printf("%s", strErrors.str().c_str());

View File

@ -1870,7 +1870,7 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
}
// Update best block in wallet (so we can detect restored wallets)
if (!fIsInitialDownload)
if ((pindexNew->nHeight % 20160) == 0 || (!fIsInitialDownload && (pindexNew->nHeight % 144) == 0))
{
const CBlockLocator locator(pindexNew);
::SetBestChain(locator);