refactor: Mark member functions const
Summary:
This is a partial backport of core#21719
https://github.com/bitcoin/bitcoin/pull/21719/commits/faabeb854a6e46b46e4f26b22dc2c81e68e2d863
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D12699