[refactor] improve style for touched code
Summary:
This concludes backport of core#21062 [4/4]
https://github.com/bitcoin/bitcoin/pull/21062/commits/53e716ea119658c28935fee24eb50090907c500e
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D11781