mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
merge bitcoin#23392: move check_node_connections to util
This commit is contained in:
parent
f6fa0c06b8
commit
1b241a2832
@ -8,18 +8,12 @@ import os
|
|||||||
|
|
||||||
from test_framework.p2p import P2PInterface
|
from test_framework.p2p import P2PInterface
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import assert_equal
|
from test_framework.util import check_node_connections
|
||||||
|
|
||||||
INBOUND_CONNECTIONS = 5
|
INBOUND_CONNECTIONS = 5
|
||||||
BLOCK_RELAY_CONNECTIONS = 2
|
BLOCK_RELAY_CONNECTIONS = 2
|
||||||
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
class AnchorsTest(BitcoinTestFramework):
|
class AnchorsTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
@ -6,13 +6,7 @@
|
|||||||
|
|
||||||
from test_framework.p2p import P2PInterface
|
from test_framework.p2p import P2PInterface
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import assert_equal
|
from test_framework.util import check_node_connections
|
||||||
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
class P2PAddConnections(BitcoinTestFramework):
|
class P2PAddConnections(BitcoinTestFramework):
|
||||||
|
@ -264,6 +264,7 @@ def wait_until_helper(predicate, *, attempts=float('inf'), timeout=float('inf'),
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def sha256sum_file(filename):
|
def sha256sum_file(filename):
|
||||||
h = hashlib.sha256()
|
h = hashlib.sha256()
|
||||||
with open(filename, 'rb') as f:
|
with open(filename, 'rb') as f:
|
||||||
@ -479,6 +480,11 @@ def set_node_times(nodes, t):
|
|||||||
node.mocktime = t
|
node.mocktime = t
|
||||||
node.setmocktime(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)
|
||||||
|
|
||||||
|
|
||||||
def force_finish_mnsync(node):
|
def force_finish_mnsync(node):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user