test: add check_node_connections in util
Summary:
This function (check_node_connections) exists in feature_anchors.py and p2p_add_connections.py and does the same thing in both, this PR moves this function to util to avoid repetition and facilitate maintenance.
Backport of core#23392 and core#23774 (missing import fix).
Depends on D10966.
Ref T1696.
Test Plan:
ninja check-functional
Reviewers: #bitcoin_abc, PiRK
Reviewed By: #bitcoin_abc, PiRK
Maniphest Tasks: T1696
Differential Revision: https://reviews.bitcoinabc.org/D10967