Skip to content

Commit

Permalink
fixed potential deadlock in CSuperblockManager::IsSuperblockTriggered (
Browse files Browse the repository at this point in the history
…#1536)

governance.cs -> mempool.cs:
`CGovernanceManager::ProcessMessage - LOCK2(cs_main, governance.cs) ->  GetTransaction ->  lookup - LOCK(mempool.cs)`

mempool.cs -> governance.cs:
`CreateNewBlock - LOCK2(cs_main, mempool.cs)  -> FillBlockPayments ->  IsSuperblockTriggered - LOCK(governance.cs)`
  • Loading branch information
the-schnibble authored and UdjinM6 committed Jul 18, 2017
1 parent 290fb3b commit 6cb3fdd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "consensus/consensus.h"
#include "consensus/merkle.h"
#include "consensus/validation.h"
#include "governance-classes.h"
#include "hash.h"
#include "main.h"
#include "net.h"
Expand Down Expand Up @@ -124,7 +125,8 @@ CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const CScript& s
CAmount nFees = 0;

{
LOCK2(cs_main, mempool.cs);
LOCK2(cs_main, governance.cs);
LOCK(mempool.cs);
CBlockIndex* pindexPrev = chainActive.Tip();
const int nHeight = pindexPrev->nHeight + 1;
pblock->nTime = GetAdjustedTime();
Expand Down

0 comments on commit 6cb3fdd

Please sign in to comment.