The initial commit added tests that are not relevant for us,
but also did some minor refactoring that could add more robustness
if the tests evolve in the future (remember `extra_args` in
`setup_network` in nodes are restarted).
The initial commit introduced a bug later fixed in PR16920.
This fix taken into accound here.
This concludes backport of Core PR16465 - part 3 of 3
Commit https://github.com/bitcoin/bitcoin/pull/16465/commits/fa25668e1c8982548f1c6f94780709c625811469
Depends on D8055