> In PeerLogicValidation::PeerLogicValidation() we would schedule a lambda
> function to execute later, capturing the local variable
> `consensusParams` by reference.
>
> Presumably this was considered safe because `consensusParams` is a
> reference itself to a global variable which is not supposed to change,
> but it can in tests.
>
> Fixes https://github.com/bitcoin/bitcoin/issues/18372
This is a backport of core#18376