Skip to content

Commit 81fd79a

Browse files
committed
Merge #739: Take mempool locks when doing compact block RPC calls touching mempool
67a669e Take mempool locks when doing compact block RPC calls touching mempool (Gregory Sanders) Pull request description: This may help reduce the failures in `feature_blocksign.py` that seem to occur fairly often. It could be that the mempool is in an inconsistent state, which messed up compact block finalization. Tree-SHA512: cd066933cf58b3c57869db3fd97c2de0ff554d442e91051f43626b12778d55835065ad5fc42fed09b7750796e9e0b2e6947f1ac54e02fe4c8e2a84fe340429ae
2 parents 4b2fac4 + 67a669e commit 81fd79a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/rpc/mining.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,7 @@ UniValue consumecompactsketch(const JSONRPCRequest& request)
12451245
CBlockHeaderAndShortTxIDs cmpctblock;
12461246
ssBlock >> cmpctblock;
12471247

1248+
LOCK(mempool.cs);
12481249
PartiallyDownloadedBlock partialBlock(&mempool);
12491250
const std::vector<std::pair<uint256, CTransactionRef>> dummy;
12501251
ReadStatus status = partialBlock.InitData(cmpctblock, dummy);
@@ -1376,6 +1377,7 @@ UniValue finalizecompactblock(const JSONRPCRequest& request)
13761377
found.insert(found.end(), transactions.txn.begin(), transactions.txn.end());
13771378

13781379
// Now construct the final block!
1380+
LOCK(mempool.cs);
13791381
PartiallyDownloadedBlock partialBlock(&mempool);
13801382

13811383
const std::vector<std::pair<uint256, CTransactionRef>> dummy;

0 commit comments

Comments
 (0)