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