[bitcoin/bitcoin] Simple refactoring: Common code for decoding of hex «objects» (#14009)

`DecodeHexBlk` and `DecodeHexBlockHeader` have exactly the same implementation, except that they decode a `CBlock` and `CBlockHeader` object, respectively. Thus we can share the common code through a template.
You can view, comment on, or merge this pull request online at:

https://github.com/bitcoin/bitcoin/pull/14009

— Commit Summary —

* Common code for decoding of hex «objects».

— File Changes —

M src/core_read.cpp (34)

— Patch Links —

https://github.com/bitcoin/bitcoin/pull/14009.patch
https://github.com/bitcoin/bitcoin/pull/14009.diff