[backport#14518] rpc: Always throw in getblockstats if -txindex is required
Summary:
3be209d103297aaf2fe4711e237a65046488ea19 rpc: Always throw in getblockstats if -txindex is required (João Barbosa)
Pull request description:
Previously blocks with only the coinbase transaction didn't cause the RPC error even if the requested stats required -txindex and it wasn't enabled. Fixes #14499.
https://github.com/bitcoin/bitcoin/pull/14518/commits/3be209d103297aaf2fe4711e237a65046488ea19
Backport of Core PR14518
Test Plan:
ninja check-all
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D6287