HomePhabricator

[thread safety] prevent double lock of cs_main in calls to CChainState…

Description

[thread safety] prevent double lock of cs_main in calls to CChainState::UnwindBlock

Summary:
In upcoming backport D6940 InvalidateBlock(…) requires mutex cs_main not to be held. Currently we are requiring FinalizeBlock
to be called while cs_main is locked, leading to duplicate calls to LOCK(cs_main), this diff changes that.

Depends on D7203

Note to reviewer: feedback on this diff has been addressed by upcoming D7204. if preferable, they could be squashed together as to avoid any revision from having potential funny locking behavior in FinalizeBlock

Test Plan:

cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug
ninja check && ninja check-functional

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D6956

Details

Provenance
majcostaAuthored on Jul 16 2020, 19:22
majcostaPushed on Aug 18 2020, 13:25
Reviewer
Restricted Project
Differential Revision
D6956: [thread safety] prevent double lock of cs_main in calls to CChainState::UnwindBlock
Parents
rABC85fc9dfe0a61: [refactor] move Park and InvalidateBlock to CChainState public API
Branches
Unknown
Tags
Unknown