As detailed in #21627, there is a potential data race on fHavePruned
as one thread could be reading it while another one is writing to it.
Guard fHavePruned
, lock in IsBlockPruned
(FlushStateToDisk
is holding cs_main
while writing to the variable, so this ensures that the data race cannot occur).