Require IsBlockPruned() to hold mutex cs_main
Summary:
Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
This is a partial backport of core#22932
https://github.com/bitcoin/bitcoin/pull/22932/commits/eaeeb88768db529b5241ccd42f1e87579908b4df
Depends on D13036
Test Plan:
With clang and DEBUG:
ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D13037