rpc: reduce LOCK(cs_main) scope in GetBlockChecked and getblock
Summary:
This is a partial backport of core#26308
https://github.com/bitcoin/bitcoin/pull/26308/commits/f00808e932c1f67bc76702a3f05778074b10025c
Depends on D13053
Test Plan:
With Clang and DEBUG:
ninja all check-all
Reviewers: #bitcoin_abc, sdulfari
Reviewed By: #bitcoin_abc, sdulfari
Differential Revision: https://reviews.bitcoinabc.org/D13054