[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