Add missing locks after backporting 12333 (#3587)

This commit is contained in:
UdjinM6 2020-07-07 09:06:59 +03:00 committed by GitHub
parent c59dafb708
commit 497c3fbc85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -225,6 +225,8 @@ UniValue masternode_outputs(const JSONRPCRequest& request)
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
return NullUniValue; return NullUniValue;
LOCK2(cs_main, pwallet->cs_wallet);
// Find possible candidates // Find possible candidates
std::vector<COutput> vPossibleCoins; std::vector<COutput> vPossibleCoins;
CCoinControl coin_control; CCoinControl coin_control;

View File

@ -3313,6 +3313,8 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nC
bool CWallet::SelectPSInOutPairsByDenominations(int nDenom, CAmount nValueMax, std::vector< std::pair<CTxDSIn, CTxOut> >& vecPSInOutPairsRet) bool CWallet::SelectPSInOutPairsByDenominations(int nDenom, CAmount nValueMax, std::vector< std::pair<CTxDSIn, CTxOut> >& vecPSInOutPairsRet)
{ {
LOCK2(cs_main, cs_wallet);
CAmount nValueTotal{0}; CAmount nValueTotal{0};
std::set<uint256> setRecentTxIds; std::set<uint256> setRecentTxIds;
@ -3460,6 +3462,8 @@ bool CWallet::SelectCoinsGroupedByAddresses(std::vector<CompactTallyItem>& vecTa
bool CWallet::SelectDenominatedAmounts(CAmount nValueMax, std::set<CAmount>& setAmountsRet) const bool CWallet::SelectDenominatedAmounts(CAmount nValueMax, std::set<CAmount>& setAmountsRet) const
{ {
LOCK2(cs_main, cs_wallet);
CAmount nValueTotal{0}; CAmount nValueTotal{0};
setAmountsRet.clear(); setAmountsRet.clear();
@ -3503,6 +3507,8 @@ bool CWallet::GetCollateralTxDSIn(CTxDSIn& txdsinRet, CAmount& nValueRet) const
bool CWallet::GetMasternodeOutpointAndKeys(COutPoint& outpointRet, CPubKey& pubKeyRet, CKey& keyRet, const std::string& strTxHash, const std::string& strOutputIndex) bool CWallet::GetMasternodeOutpointAndKeys(COutPoint& outpointRet, CPubKey& pubKeyRet, CKey& keyRet, const std::string& strTxHash, const std::string& strOutputIndex)
{ {
LOCK2(cs_main, cs_wallet);
// wait for reindex and/or import to finish // wait for reindex and/or import to finish
if (fImporting || fReindex) return false; if (fImporting || fReindex) return false;
@ -3579,6 +3585,8 @@ int CWallet::CountInputsWithAmount(CAmount nInputAmount) const
bool CWallet::HasCollateralInputs(bool fOnlyConfirmed) const bool CWallet::HasCollateralInputs(bool fOnlyConfirmed) const
{ {
LOCK2(cs_main, cs_wallet);
std::vector<COutput> vCoins; std::vector<COutput> vCoins;
CCoinControl coin_control; CCoinControl coin_control;
coin_control.nCoinType = CoinType::ONLY_PRIVATESEND_COLLATERAL; coin_control.nCoinType = CoinType::ONLY_PRIVATESEND_COLLATERAL;