This is a squash of 2 commits, to add the unbroken test and the solution
at the same time.
> test: Add unregister_validation_interface_race test
https://github.com/bitcoin/bitcoin/pull/18742/commits/fab6d060ce5f580db538070beec1c5518c8c777c
> miner: Avoid stack-use-after-return in validationinterface
>
> This is achieved by switching to a shared_ptr.
>
> Also, switch the validationinterfaces in the tests to use shared_ptrs
> for the same reason.
https://github.com/bitcoin/bitcoin/pull/18742/commits/7777f2a4bb1f9d843bc50a4e35085cfbb2808780
This is a backport of Core [[https://github.com/bitcoin/bitcoin/pull/18742 | PR18742]] [3/3]
This replaces the solution in D5140
See comment https://reviews.bitcoinabc.org/D5140#124338