diff options
author | Jon Atack <jon@atack.com> | 2021-09-09 17:17:39 +0200 |
---|---|---|
committer | Jon Atack <jon@atack.com> | 2022-01-25 20:43:12 +0100 |
commit | 6fd4341c10b319399c58d71c4ddeae4417e337d7 (patch) | |
tree | 0fce39f92baaeede34c7f6ef7e0111fc435b73b8 /src/index | |
parent | 39d9bbe4acd7441aa9a61c57b76d887c4225a0e2 (diff) |
Require CBlockIndex::GetBlockPos() to hold mutex cs_main
Diffstat (limited to 'src/index')
-rw-r--r-- | src/index/txindex.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/index/txindex.cpp b/src/index/txindex.cpp index e9aeb58194..e1d807f39a 100644 --- a/src/index/txindex.cpp +++ b/src/index/txindex.cpp @@ -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) { |