mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-15 18:08:57 +00: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 faff50d129b6d4b9e6397ac989218e83a26ae692)
This commit is contained in:
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user