Note that we unfortunately can't use a scripted diff here, as the
sha256 symbol is also used for other instances (e.g. as function
in hashlib, or in the UTXO class in p2p_segwit.py).
This is a partial backport of core#32868
https://github.com/bitcoin/bitcoin/pull/32868/commits/23be0ec2f074516a1177cda620a20e4c3ef1b28d
Depends on D18739