Changeset View
Changeset View
Standalone View
Standalone View
test/functional/net.py
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | def _test_getnetworkinginfo(self): | ||||
timeout = 3 | timeout = 3 | ||||
while self.nodes[0].getnetworkinfo()['connections'] != 0: | while self.nodes[0].getnetworkinfo()['connections'] != 0: | ||||
# Wait a bit for all sockets to close | # Wait a bit for all sockets to close | ||||
assert timeout > 0, 'not all connections closed in time' | assert timeout > 0, 'not all connections closed in time' | ||||
timeout -= 0.1 | timeout -= 0.1 | ||||
time.sleep(0.1) | time.sleep(0.1) | ||||
self.nodes[0].setnetworkactive(True) | self.nodes[0].setnetworkactive(True) | ||||
connect_nodes_bi(self.nodes, 0, 1) | connect_nodes_bi(self.nodes[0], self.nodes[1]) | ||||
assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], True) | assert_equal(self.nodes[0].getnetworkinfo()['networkactive'], True) | ||||
assert_equal(self.nodes[0].getnetworkinfo()['connections'], 2) | assert_equal(self.nodes[0].getnetworkinfo()['connections'], 2) | ||||
def _test_getaddednodeinfo(self): | def _test_getaddednodeinfo(self): | ||||
assert_equal(self.nodes[0].getaddednodeinfo(), []) | assert_equal(self.nodes[0].getaddednodeinfo(), []) | ||||
# add a node (node2) to node0 | # add a node (node2) to node0 | ||||
ip_port = "127.0.0.1:{}".format(p2p_port(2)) | ip_port = "127.0.0.1:{}".format(p2p_port(2)) | ||||
self.nodes[0].addnode(ip_port, 'add') | self.nodes[0].addnode(ip_port, 'add') | ||||
Show All 18 Lines |