Skip to content

Commit 6cb3fdd

Browse files
Ilya SavinovUdjinM6
authored andcommitted
fixed potential deadlock in CSuperblockManager::IsSuperblockTriggered (#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)`
1 parent 290fb3b commit 6cb3fdd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/miner.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "consensus/consensus.h"
1414
#include "consensus/merkle.h"
1515
#include "consensus/validation.h"
16+
#include "governance-classes.h"
1617
#include "hash.h"
1718
#include "main.h"
1819
#include "net.h"
@@ -124,7 +125,8 @@ CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const CScript& s
124125
CAmount nFees = 0;
125126

126127
{
127-
LOCK2(cs_main, mempool.cs);
128+
LOCK2(cs_main, governance.cs);
129+
LOCK(mempool.cs);
128130
CBlockIndex* pindexPrev = chainActive.Tip();
129131
const int nHeight = pindexPrev->nHeight + 1;
130132
pblock->nTime = GetAdjustedTime();

0 commit comments

Comments
 (0)