Skip to content

Commit d76962e

Browse files
committed
rpc: Reduce cs_main lock in listunspent
1 parent 979150b commit d76962e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3149,9 +3149,13 @@ UniValue listunspent(const JSONRPCRequest& request)
31493149

31503150
UniValue results(UniValue::VARR);
31513151
std::vector<COutput> vecOutputs;
3152-
LOCK2(cs_main, pwallet->cs_wallet);
3152+
{
3153+
LOCK2(cs_main, pwallet->cs_wallet);
3154+
pwallet->AvailableCoins(vecOutputs, !include_unsafe, nullptr, nMinimumAmount, nMaximumAmount, nMinimumSumAmount, nMaximumCount, nMinDepth, nMaxDepth);
3155+
}
3156+
3157+
LOCK(pwallet->cs_wallet);
31533158

3154-
pwallet->AvailableCoins(vecOutputs, !include_unsafe, nullptr, nMinimumAmount, nMaximumAmount, nMinimumSumAmount, nMaximumCount, nMinDepth, nMaxDepth);
31553159
for (const COutput& out : vecOutputs) {
31563160
CTxDestination address;
31573161
const CScript& scriptPubKey = out.tx->tx->vout[out.i].scriptPubKey;

0 commit comments

Comments
 (0)