aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorW. J. van der Laan <laanwj@protonmail.com>2021-11-29 13:48:17 +0100
committerW. J. van der Laan <laanwj@protonmail.com>2021-11-29 13:51:27 +0100
commita574f4ad390908ace794eb10fdb917d66c57094b (patch)
treea2b9b1b1d5ba2bb5c34f6c9224dd31eea198d249 /test/functional/test_framework
parent014cae2ee8386bfd074d1882148dc684b094cf57 (diff)
parent988024fe37fe00c2deff28e44593e330aa6191f4 (diff)
downloadbitcoin-a574f4ad390908ace794eb10fdb917d66c57094b.tar.xz
Merge bitcoin/bitcoin#23392: test: move check_node_connections to util
988024fe37fe00c2deff28e44593e330aa6191f4 test: add check_node_connections in util (brunoerg) Pull request description: This function (`check_node_connections`) exists in `feature_anchors.py` and `p2p_add_connections.py` and does the same thing in both, this PR moves this function to util to avoid repetition and facilitate maintenance. ACKs for top commit: laanwj: Code review ACK 988024fe37fe00c2deff28e44593e330aa6191f4 Tree-SHA512: bf86c5659933539c72cb91ad587552b45c918be74d36fb429e78f3b954f01ed0855a85dd49aea35b432fbd18227c05eb3fec8b99c139c3509c39b19bccf6b7fd
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 57ef6d99d5..c3a9029d55 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
#############################