[wallet] Make CWallet::ListCoins atomic

zcash: Not an actual locking fix; just eliminates unnecessary recursive
zcash: locking (which is a long-term goal).
zcash: cherry picked from commit 1beea7af92994dca83facb11bbef82b24b538400
zcash: https://github.com/bitcoin/bitcoin/pull/12333
This commit is contained in:
João Barbosa 2018-02-02 11:37:50 +00:00 committed by Larry Ruane
parent 829e801fd9
commit 5b2f7a6ea7
1 changed files with 3 additions and 1 deletions

View File

@ -3227,10 +3227,12 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins,
std::set<CTxDestination>* onlyFilterByDests) const
{
assert(nMinDepth >= 0);
AssertLockHeld(cs_main);
AssertLockHeld(cs_wallet);
vCoins.clear();
{
LOCK2(cs_main, cs_wallet);
for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
{
const uint256& wtxid = it->first;