Previously, cs_main
had to be locked during GetBlockChecked
in the getblock
rpc call. This made parallel getblock
calls slower, for example in Fulcrum.
By moving the pruned check out of GetBlockChecked
into a separate function, cs_main
is no longer locked during ReadBlockFromDisk
.
It still locks cs_main
if pruning is enabled to prevent a race condition (#13903), so the performance improvement will only be noticeable without pruning.