Merge pull request #5280 from nuttycom/bug/set_best_chain_wallet_lock
Lock the wallet in SetBestChainINTERNAL
This commit is contained in:
commit
df6574b07d
|
@ -189,6 +189,10 @@ void ThreadNotifyWallets(CBlockIndex *pindexLastTip)
|
|||
SyncWithWallets(tx, NULL, pindexLastTip->nHeight);
|
||||
}
|
||||
// Update cached incremental witnesses
|
||||
// This will take the cs_main lock in order to obtain the CBlockLocator
|
||||
// used by `SetBestChain`, but as that write only occurs once every
|
||||
// WRITE_WITNESS_INTERVAL * 1000000 microseconds this should not be
|
||||
// exploitable as a timing channel.
|
||||
GetMainSignals().ChainTip(pindexLastTip, &block, std::nullopt);
|
||||
|
||||
// On to the next block!
|
||||
|
@ -220,6 +224,10 @@ void ThreadNotifyWallets(CBlockIndex *pindexLastTip)
|
|||
SyncWithWallets(tx, &block, blockData.pindex->nHeight);
|
||||
}
|
||||
// Update cached incremental witnesses
|
||||
// This will take the cs_main lock in order to obtain the CBlockLocator
|
||||
// used by `SetBestChain`, but as that write only occurs once every
|
||||
// WRITE_WITNESS_INTERVAL * 1000000 microseconds this should not be
|
||||
// exploitable as a timing channel.
|
||||
GetMainSignals().ChainTip(blockData.pindex, &block, blockData.oldTrees);
|
||||
|
||||
// This block is done!
|
||||
|
|
|
@ -759,6 +759,7 @@ protected:
|
|||
return;
|
||||
}
|
||||
try {
|
||||
LOCK(cs_wallet);
|
||||
for (std::pair<const uint256, CWalletTx>& wtxItem : mapWallet) {
|
||||
auto wtx = wtxItem.second;
|
||||
// We skip transactions for which mapSproutNoteData and mapSaplingNoteData
|
||||
|
|
Loading…
Reference in New Issue