This is needed so that it can be used by RPCResult
Also,
Backport of Bitcoin Core PR#17809, part 1/2
Backport of Bitcoin ABC D8123
Test plan: ninja check check-functional
ninja check check-functional