mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
Fixes a race condition in CreateNewBlock.
CreateNewBlock was reading pindexBest at the start before taking the lock
so it was possible to have the the block content not match the prevheader.
(Partial of faff50d129)
This commit is contained in:
committed by
Luke Dashjr
parent
b3f8f6ab94
commit
2d2e5bdcf4
@@ -3032,7 +3032,7 @@ public:
|
||||
|
||||
CBlock* CreateNewBlock(CReserveKey& reservekey)
|
||||
{
|
||||
CBlockIndex* pindexPrev = pindexBest;
|
||||
CBlockIndex* pindexPrev;
|
||||
|
||||
// Create new block
|
||||
auto_ptr<CBlock> pblock(new CBlock());
|
||||
@@ -3054,6 +3054,7 @@ CBlock* CreateNewBlock(CReserveKey& reservekey)
|
||||
CRITICAL_BLOCK(cs_main)
|
||||
CRITICAL_BLOCK(cs_mapTransactions)
|
||||
{
|
||||
pindexPrev = pindexBest;
|
||||
CTxDB txdb("r");
|
||||
|
||||
// Priority order to process transactions
|
||||
|
||||
Reference in New Issue
Block a user