Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_node.py
Show First 20 Lines • Show All 206 Lines • ▼ Show 20 Lines | class TestNode(): | ||||
def p2p(self): | def p2p(self): | ||||
"""Return the first p2p connection | """Return the first p2p connection | ||||
Convenience property - most tests only use a single p2p connection to each | Convenience property - most tests only use a single p2p connection to each | ||||
node, so this saves having to write node.p2ps[0] many times.""" | node, so this saves having to write node.p2ps[0] many times.""" | ||||
assert self.p2ps, "No p2p connection" | assert self.p2ps, "No p2p connection" | ||||
return self.p2ps[0] | return self.p2ps[0] | ||||
def disconnect_p2p(self, index=0): | def disconnect_p2ps(self): | ||||
"""Close the p2p connection to the node.""" | """Close all p2p connections to the node.""" | ||||
# Connection could have already been closed by other end. Calling disconnect_p2p() | for p in self.p2ps: | ||||
# on an already disconnected p2p connection is not an error. | # Connection could have already been closed by other end. | ||||
if self.p2ps[index].connection is not None: | if p.connection is not None: | ||||
self.p2ps[index].connection.disconnect_node() | p.connection.disconnect_node() | ||||
del self.p2ps[index] | self.p2ps = [] | ||||
class TestNodeCLI(): | class TestNodeCLI(): | ||||
"""Interface to bitcoin-cli for an individual node""" | """Interface to bitcoin-cli for an individual node""" | ||||
def __init__(self, binary, datadir): | def __init__(self, binary, datadir): | ||||
self.args = [] | self.args = [] | ||||
self.binary = binary | self.binary = binary | ||||
Show All 36 Lines |