More bestblock records in wallets

Write bestblock records in wallets:
* Every 20160 blocks synced, no matter what (before: none during IBD)
* Every 144 blocks after IBD (before: for every block, slow)
* When creating a new wallet
* At shutdown

This should result in far fewer spurious rescans.
This commit is contained in:
Pieter Wuille
2013-05-22 20:58:53 +02:00
parent 6b99cfae3c
commit 95c7db3dbf
2 changed files with 4 additions and 1 deletions

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);