test: disconnect_nodes should warn if nodes were already disconnected
Summary:
test: warn if nodes not connected before disconnect_nodes
test: remove redundant two-way disconnect_nodes calls
PR description:
There's no harm in calling disconnect_nodes for nodes that weren't connected (in this case it's a no-op). However, detecting this case and logging a warning can help ensure that tests are behaving as expected.
In addition, since disconnect_nodes works bidirectionally, I removed all instances of this pattern:
disconnect_nodes(self.nodes[0], 1) disconnect_nodes(self.nodes[1], 0)
This is a backport of core#18890
One of the 3 commits is a no-op for our codebase, as it is touching only a segwit related test.
Test Plan: ninja check-functional
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D9523