rpc: reduce LOCK(cs_main) scope in gettxoutproof
Summary:
This concludes backport of core#26308
https://github.com/bitcoin/bitcoin/pull/26308/commits/d7f61e7d5909da7227c9e34be06ce9eb872ba074
Depends on D13055
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/D13057