The helper was moved in commit b026e318c39f59a06e29f1b25c7f577e01b25ccb,
which also mentioned that it could be moved to CChainState. So do that,
as the functionality is not block-storage related.This also allows to drop one function argument.
This is a backport of core#23785
https://github.com/bitcoin/bitcoin/pull/23785/commits/fa3d62cf7b3501a056b34c5458c14d2fe6a55bd7