Deadlock fixes (#1087)
* Fix deadlocks by reducing scope of cs_main locks in rpcgovernance.cpp * Remove unnecessary mutex lock in GetMasternodeVinAndKeys which can cause a deadlock
This commit is contained in:
parent
2d55b70381
commit
1b230f4ddc
@ -83,8 +83,11 @@ UniValue gobject(const UniValue& params, bool fHelp)
|
||||
|
||||
// ASSEMBLE NEW GOVERNANCE OBJECT FROM USER PARAMETERS
|
||||
|
||||
LOCK(cs_main);
|
||||
CBlockIndex* pindex = chainActive.Tip();
|
||||
CBlockIndex* pindex = NULL;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
CBlockIndex* pindex = chainActive.Tip();
|
||||
}
|
||||
|
||||
std::vector<CMasternodeConfig::CMasternodeEntry> mnEntries;
|
||||
mnEntries = masternodeConfig.getEntries();
|
||||
@ -157,8 +160,11 @@ UniValue gobject(const UniValue& params, bool fHelp)
|
||||
|
||||
// ASSEMBLE NEW GOVERNANCE OBJECT FROM USER PARAMETERS
|
||||
|
||||
LOCK(cs_main);
|
||||
CBlockIndex* pindex = chainActive.Tip();
|
||||
CBlockIndex* pindex = NULL;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
CBlockIndex* pindex = chainActive.Tip();
|
||||
}
|
||||
|
||||
uint256 txidFee;
|
||||
|
||||
@ -547,7 +553,7 @@ UniValue gobject(const UniValue& params, bool fHelp)
|
||||
|
||||
// SETUP BLOCK INDEX VARIABLE / RESULTS VARIABLE
|
||||
|
||||
CBlockIndex* pindex;
|
||||
CBlockIndex* pindex = NULL;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
pindex = chainActive.Tip();
|
||||
|
@ -2701,9 +2701,6 @@ bool CWallet::GetMasternodeVinAndKeys(CTxIn& txinRet, CPubKey& pubKeyRet, CKey&
|
||||
if (fImporting || fReindex) return false;
|
||||
|
||||
// Find possible candidates
|
||||
TRY_LOCK(cs_wallet, fWallet);
|
||||
if(!fWallet) return false;
|
||||
|
||||
std::vector<COutput> vPossibleCoins;
|
||||
AvailableCoins(vPossibleCoins, true, NULL, false, ONLY_1000);
|
||||
if(vPossibleCoins.empty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user