mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 10:42:13 +02:00
Require CBlockIndex::GetBlockPos() to hold mutex cs_main
This commit is contained in:
@@ -59,7 +59,9 @@ bool TxIndex::WriteBlock(const CBlock& block, const CBlockIndex* pindex)
|
||||
// Exclude genesis block transaction because outputs are not spendable.
|
||||
if (pindex->nHeight == 0) return true;
|
||||
|
||||
CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(block.vtx.size()));
|
||||
CDiskTxPos pos{
|
||||
WITH_LOCK(::cs_main, return pindex->GetBlockPos()),
|
||||
GetSizeOfCompactSize(block.vtx.size())};
|
||||
std::vector<std::pair<uint256, CDiskTxPos>> vPos;
|
||||
vPos.reserve(block.vtx.size());
|
||||
for (const auto& tx : block.vtx) {
|
||||
|
||||
Reference in New Issue
Block a user