Note that we unfortunately can't use a scripted diff here, as the same
property and method name is also used for CBlockHeader/CBlock instances.
This is a partial backport of core#32421
https://github.com/bitcoin/bitcoin/pull/32421/commits/ce83924237127fe6d32b63c362b57789e4628954
Depends on D18713