Skip to content

Commit 7517294

Browse files
committed
Fix mempool.cs vs cs_inventory potential deadlock
POTENTIAL DEADLOCK DETECTED Previous lock order was: pnode->cs_sendProcessing net.cpp:2724 cs_main net_processing.cpp:3867 (TRY) (1) pto->cs_inventory net_processing.cpp:4106 (2) cs txmempool.cpp:1137 Current lock order is: cs_main wallet/rpcwallet.cpp:468 (2) mempool.cs wallet/rpcwallet.cpp:468 pwallet->cs_wallet wallet/rpcwallet.cpp:469 cs_main wallet/wallet.cpp:4045 (2) mempool.cs wallet/wallet.cpp:4045 cs_wallet wallet/wallet.cpp:4046 cs_vNodes net.cpp:3464 (1) cs_inventory ./net.h:1056
1 parent ee847c7 commit 7517294

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4103,7 +4103,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto, std::atomic<bool>& interruptM
41034103
reserve = std::min<size_t>(reserve, MAX_INV_SZ);
41044104
vInv.reserve(reserve);
41054105

4106-
LOCK(pto->cs_inventory);
4106+
LOCK2(mempool.cs, pto->cs_inventory);
41074107

41084108
// Add blocks
41094109
for (const uint256& hash : pto->vInventoryBlockToSend) {

0 commit comments

Comments
 (0)