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.