diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-11-14 08:56:04 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-11-14 08:56:37 +0100 |
commit | 7adeea3b0fc26025c06590125a48ce2651c66373 (patch) | |
tree | e05cb13e84c54ec6ab71d2ffb754feeb2e5c585a /test/functional/test_framework | |
parent | cbb54e77a120a69fc6faaecbdc4cf93915afb89c (diff) | |
parent | faaa7db25e94cf02818865e3d27707d6acaa1e25 (diff) |
Merge #11641: qa: Only allow disconnecting all NodeConns
faaa7db qa: Only allow disconnecting all NodeConns (MarcoFalke)
Pull request description:
Disconnecting the connection with `index=0` makes no sense when there are more than one connections, as the list "rotates around" and populates index 0 after `del`.
Just disconnect all NodeConns in any case.
Tree-SHA512: e5cf540823fccb31634b5a11501f54222be89862e80ccafc28bc06726480f8d2153b8c1b6f859fa6a6d087876251d48a6c6035bccdaaf16831e300bc17ff613d
Diffstat (limited to 'test/functional/test_framework')
-rwxr-xr-x | test/functional/test_framework/test_node.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 8b28064c46..73018ee5da 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -182,13 +182,14 @@ class TestNode(): assert self.p2ps, "No p2p connection" return self.p2ps[0] - def disconnect_p2p(self, index=0): - """Close the p2p connection to the node.""" - # Connection could have already been closed by other end. Calling disconnect_p2p() - # on an already disconnected p2p connection is not an error. - if self.p2ps[index].connection is not None: - self.p2ps[index].connection.disconnect_node() - del self.p2ps[index] + def disconnect_p2ps(self): + """Close all p2p connections to the node.""" + for p in self.p2ps: + # Connection could have already been closed by other end. + if p.connection is not None: + p.connection.disconnect_node() + self.p2ps = [] + class TestNodeCLI(): """Interface to bitcoin-cli for an individual node""" |