Write witness caches when writing the best block
For steady-state operation, this reduces the average time between wallet disk writes from once per block to once per hour. On -rescan, witness caches are only written out at the end along with the best block, increasing speed while ensuring that on-disk state is kept consistent. Witness caches are now never recreated during a -reindex, on the assumption that the blocks themselves are not changing (the chain is just being reconstructed), and so the witnesses will remain valid. Part of #1749.
This commit is contained in:
@@ -537,11 +537,6 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
|
||||
RenameThread("zcash-loadblk");
|
||||
// -reindex
|
||||
if (fReindex) {
|
||||
#ifdef ENABLE_WALLET
|
||||
if (pwalletMain) {
|
||||
pwalletMain->ClearNoteWitnessCache();
|
||||
}
|
||||
#endif
|
||||
CImportingNow imp;
|
||||
int nFile = 0;
|
||||
while (true) {
|
||||
@@ -1379,7 +1374,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
|
||||
CBlockIndex *pindexRescan = chainActive.Tip();
|
||||
if (GetBoolArg("-rescan", false))
|
||||
{
|
||||
pwalletMain->ClearNoteWitnessCache();
|
||||
pindexRescan = chainActive.Genesis();
|
||||
}
|
||||
else
|
||||
{
|
||||
CWalletDB walletdb(strWalletFile);
|
||||
|
||||
Reference in New Issue
Block a user