Only build witness cache when needed
This commit is contained in:
@@ -2717,10 +2717,12 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
|||||||
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((Checkpoints::GuessVerificationProgress(chainParams.Checkpoints(), pindex, false) - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
|
ShowProgress(_("Rescanning..."), std::max(1, std::min(99, (int)((Checkpoints::GuessVerificationProgress(chainParams.Checkpoints(), pindex, false) - dProgressStart) / (dProgressTip - dProgressStart) * 100))));
|
||||||
|
|
||||||
CBlock block;
|
CBlock block;
|
||||||
|
bool involvesMe = false;
|
||||||
ReadBlockFromDisk(block, pindex,1);
|
ReadBlockFromDisk(block, pindex,1);
|
||||||
BOOST_FOREACH(CTransaction& tx, block.vtx)
|
BOOST_FOREACH(CTransaction& tx, block.vtx)
|
||||||
{
|
{
|
||||||
if (AddToWalletIfInvolvingMe(tx, &block, fUpdate)) {
|
if (AddToWalletIfInvolvingMe(tx, &block, fUpdate)) {
|
||||||
|
involvesMe = true;
|
||||||
ret++;
|
ret++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2734,8 +2736,11 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build initial witness caches
|
// Build initial witness caches for blocks involving one of our addresses
|
||||||
BuildWitnessCache(pindex, true);
|
if (involvesMe) {
|
||||||
|
LogPrintf("%s: block has one of our transactions, building witness cache", __func__);
|
||||||
|
BuildWitnessCache(pindex, true);
|
||||||
|
}
|
||||||
|
|
||||||
//Delete Transactions
|
//Delete Transactions
|
||||||
if (fTxDeleteEnabled) {
|
if (fTxDeleteEnabled) {
|
||||||
|
|||||||
Reference in New Issue
Block a user