[backport#15932] rpc: Add lock annotations to block{,header}ToJSON
Summary:
https://github.com/bitcoin/bitcoin/pull/15932/commits/faea56400d5578023133cf4d1c761cdeb0c3e3da
Depends on D6297
Concludes backport of Core PR15932
Test Plan:
cmake .. -GNinja -DENABLE_SANITIZERS=thread ninja check
Reviewers: #bitcoin_abc, nakihito
Reviewed By: nakihito
Differential Revision: https://reviews.bitcoinabc.org/D6300