|
|
@ -504,6 +504,31 @@ void CWallet::ChainTip(const CBlockIndex *pindex, |
|
|
|
DecrementNoteWitnesses(pindex); |
|
|
|
UpdateNullifierNoteMapForBlock(pblock); |
|
|
|
} |
|
|
|
|
|
|
|
// SetBestChain() can be expensive for large wallets, so do only
|
|
|
|
// this sometimes; the wallet state will be brought up to date
|
|
|
|
// during rescanning on startup.
|
|
|
|
int64_t nNow = GetTimeMicros(); |
|
|
|
if (nLastSetChain == 0) { |
|
|
|
// Don't flush during startup.
|
|
|
|
nLastSetChain = nNow; |
|
|
|
} |
|
|
|
// TODO: SetBestChain if DeleteWalletTransactions deletes txs
|
|
|
|
if (++nSetChainUpdates >= WITNESS_WRITE_UPDATES || nLastSetChain + (int64_t)WITNESS_WRITE_INTERVAL * 1000000 < nNow) { |
|
|
|
nLastSetChain = nNow; |
|
|
|
nSetChainUpdates = 0; |
|
|
|
CBlockLocator loc; |
|
|
|
{ |
|
|
|
// The locator must be derived from the pindex used to increment
|
|
|
|
// the witnesses above; pindex can be behind chainActive.Tip().
|
|
|
|
LOCK(cs_main); |
|
|
|
loc = chainActive.GetLocator(pindex); |
|
|
|
} |
|
|
|
{ |
|
|
|
LOCK(cs_wallet); |
|
|
|
SetBestChain(loc); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void CWallet::RunSaplingSweep(int blockHeight) { |
|
|
|