rest: reduce LOCK(cs_main) scope in rest_block
Summary:
After commit ccd8ef6 (D2979) it is no longer required to hold cs_main when calling ReadBlockFromDisk.
The first commit moves ReadBlockFromDisk outside the lock scope in rest_block, where we can see a huge performance improvement when fetching blocks with multiple threads.
This is a partial backport of core#26308
https://github.com/bitcoin/bitcoin/pull/26308/commits/c75e3d2772b00acc3850f72a8cb733a0345aa773
Test Plan:
With Clang and DEBUG:
ninja all check-all
Reviewers: #bitcoin_abc, sdulfari
Reviewed By: #bitcoin_abc, sdulfari
Subscribers: sdulfari
Differential Revision: https://reviews.bitcoinabc.org/D13052