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:
Jack Grigg
2016-11-30 14:04:37 +13:00
parent c29ab1fbb7
commit 03f83b9b0d
5 changed files with 56 additions and 30 deletions

View File

@@ -200,6 +200,10 @@ struct CBlockLocator
{
return vHave.empty();
}
friend bool operator==(const CBlockLocator& a, const CBlockLocator& b) {
return (a.vHave == b.vHave);
}
};
#endif // BITCOIN_PRIMITIVES_BLOCK_H