This is a squash of 2 commits, to add the unbroken test and the solution
at the same time, and a revert of D5140 (different solution to the same problem)
test: Add unregister_validation_interface_race test
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.
This is a backport of Core PR18742 [3/3]
Depends on D9104