Skip to content

Commit

Permalink
[wallet] Make CWallet::ListCoins atomic
Browse files Browse the repository at this point in the history
zcash: Not an actual locking fix; just eliminates unnecessary recursive
zcash: locking (which is a long-term goal).
zcash: cherry picked from commit 1beea7a
zcash: bitcoin/bitcoin#12333
  • Loading branch information
promag authored and LarryRuane committed Apr 12, 2021
1 parent 829e801 commit 5b2f7a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5b2f7a6

Please sign in to comment.