Limit the scope of cs_wallet lock in CPrivateSendClient::PrepareDenominate() (#1997)

This commit is contained in:
UdjinM6 2018-03-20 14:05:39 +03:00 committed by GitHub
parent a3bcc4307d
commit 4d442376e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1141,11 +1141,13 @@ bool CPrivateSendClient::PrepareDenominate(int nMinRounds, int nMaxRounds, std::
} }
if (CPrivateSend::GetDenominations(vecTxOutRet) != nSessionDenom) { if (CPrivateSend::GetDenominations(vecTxOutRet) != nSessionDenom) {
{
// unlock used coins on failure // unlock used coins on failure
LOCK(pwalletMain->cs_wallet); LOCK(pwalletMain->cs_wallet);
for (const auto& txin : vecTxDSInRet) { for (const auto& txin : vecTxDSInRet) {
pwalletMain->UnlockCoin(txin.prevout); pwalletMain->UnlockCoin(txin.prevout);
} }
}
keyHolderStorage.ReturnAll(); keyHolderStorage.ReturnAll();
strErrorRet = "Can't make current denominated outputs"; strErrorRet = "Can't make current denominated outputs";
return false; return false;