aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorbrunoerg <brunoely.gc@gmail.com>2021-10-28 09:42:13 -0300
committerbrunoerg <brunoely.gc@gmail.com>2021-11-18 13:40:43 -0300
commit988024fe37fe00c2deff28e44593e330aa6191f4 (patch)
tree8f4303901cfbfa0de4931890f1d4f03796dae1cb /test/functional/test_framework
parent2efc8c0999a4b99cfe3076f7312806e83e778261 (diff)
downloadbitcoin-988024fe37fe00c2deff28e44593e330aa6191f4.tar.xz
test: add check_node_connections in util
Diffstat (limited to 'test/functional/test_framework')
-rw-r--r--test/functional/test_framework/util.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py
index ca1ffd48de..c890fa1a18 100644
--- a/test/functional/test_framework/util.py
+++ b/test/functional/test_framework/util.py
@@ -269,6 +269,7 @@ def wait_until_helper(predicate, *, attempts=float('inf'), timeout=float('inf'),
raise AssertionError("Predicate {} not true after {} seconds".format(predicate_source, timeout))
raise RuntimeError('Unreachable')
+
def sha256sum_file(filename):
h = hashlib.sha256()
with open(filename, 'rb') as f:
@@ -445,6 +446,12 @@ def set_node_times(nodes, t):
node.setmocktime(t)
+def check_node_connections(*, node, num_in, num_out):
+ info = node.getnetworkinfo()
+ assert_equal(info["connections_in"], num_in)
+ assert_equal(info["connections_out"], num_out)
+
+
# Transaction/Block functions
#############################