Page MenuHomePhabricator

Require CBlockIndex::GetBlockPos() to hold mutex cs_main
ClosedPublic

Authored by PiRK on Jan 24 2023, 07:06.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC1e299c97637c: Require CBlockIndex::GetBlockPos() to hold mutex cs_main
Summary

consensus: don't call GetBlockPos in ReadBlockFromDisk without lock

The cs_main lock only covered the first invocation of CBlockIndex::GetBlockPos().

Use the blockPos local variable instead of calling the function twice, rename it to block_pos, and make it const

This is a backport of core#22895


Require CBlockIndex::GetBlockPos() to hold mutex cs_main

This is a partial backport of core#22932
https://github.com/bitcoin/bitcoin/pull/22932/commits/6fd4341c10b319399c58d71c4ddeae4417e337d7

Test Plan

With clang and DEBUG:

ninja all check-all bitcoin-fuzzers

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable