This is a backport of core PR14805 and PR14951.
Since the first one add a feature and the second reverts it, the
remaining is a refactor-only commit that improves the docstring for
add_nodes() and cuts a long line to improve readability:
https://github.com/bitcoin/bitcoin/pull/14951/commits/fa4b8c90d3d13c7382357ee9f75df4f4974aef20
Depends on D4557.