diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -41,6 +41,7 @@ self.index = i self.datadir = os.path.join(dirname, "node" + str(i)) self.rpchost = rpchost + self.name = "testnode-{}".format(i) if timewait: self.rpc_timeout = timewait else: @@ -55,7 +56,7 @@ # Most callers will just need to add extra args to the standard list below. For those callers that need more flexibity, they can just set the args property directly. self.extra_args = extra_args self.args = [self.binary, "-datadir=" + self.datadir, "-server", "-keypool=1", "-discover=0", "-rest", "-logtimemicros", - "-debug", "-debugexclude=libevent", "-debugexclude=leveldb", "-mocktime=" + str(mocktime), "-uacomment=testnode%d" % i] + "-debug", "-debugexclude=libevent", "-debugexclude=leveldb", "-mocktime=" + str(mocktime), "-uacomment=" + self.name] self.cli = TestNodeCLI( os.getenv("BITCOINCLI", "bitcoin-cli"), self.datadir) diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -381,12 +381,11 @@ def disconnect_nodes(from_node, to_node): - node_num = to_node.index - for peer_id in [peer['id'] for peer in from_node.getpeerinfo() if "testnode%d" % node_num in peer['subver']]: + for peer_id in [peer['id'] for peer in from_node.getpeerinfo() if to_node.name in peer['subver']]: from_node.disconnectnode(nodeid=peer_id) for _ in range(50): - if [peer['id'] for peer in from_node.getpeerinfo() if "testnode%d" % node_num in peer['subver']] == []: + if [peer['id'] for peer in from_node.getpeerinfo() if to_node.name in peer['subver']] == []: break time.sleep(0.1) else: