mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge b3ec1fe811 into merged_master (Bitcoin PR #18890)
This commit is contained in:
commit
89ca8ea199
6 changed files with 17 additions and 11 deletions
|
|
@ -42,9 +42,6 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
|
|||
|
||||
def disconnect_all(self):
|
||||
disconnect_nodes(self.nodes[0], 1)
|
||||
disconnect_nodes(self.nodes[1], 0)
|
||||
disconnect_nodes(self.nodes[2], 1)
|
||||
disconnect_nodes(self.nodes[2], 0)
|
||||
disconnect_nodes(self.nodes[0], 2)
|
||||
disconnect_nodes(self.nodes[1], 2)
|
||||
|
||||
|
|
|
|||
|
|
@ -46,10 +46,8 @@ class PSBTTest(BitcoinTestFramework):
|
|||
online_node = self.nodes[1]
|
||||
|
||||
# Disconnect offline node from others
|
||||
# Topology of test network is linear, so this one call is enough
|
||||
disconnect_nodes(offline_node, 1)
|
||||
disconnect_nodes(online_node, 0)
|
||||
disconnect_nodes(offline_node, 2)
|
||||
disconnect_nodes(mining_node, 0)
|
||||
|
||||
# Create watchonly on online_node
|
||||
online_node.createwallet(wallet_name='wonline', disable_private_keys=True)
|
||||
|
|
|
|||
|
|
@ -538,7 +538,6 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||
Split the network of four nodes into nodes 0/1 and 2/3.
|
||||
"""
|
||||
disconnect_nodes(self.nodes[1], 2)
|
||||
disconnect_nodes(self.nodes[2], 1)
|
||||
self.sync_all(self.nodes[:2])
|
||||
self.sync_all(self.nodes[2:])
|
||||
|
||||
|
|
|
|||
|
|
@ -402,7 +402,21 @@ def set_node_times(nodes, t):
|
|||
node.setmocktime(t)
|
||||
|
||||
def disconnect_nodes(from_connection, node_num):
|
||||
for peer_id in [peer['id'] for peer in from_connection.getpeerinfo() if "testnode%d" % node_num in peer['subver']]:
|
||||
def get_peer_ids():
|
||||
result = []
|
||||
for peer in from_connection.getpeerinfo():
|
||||
if "testnode{}".format(node_num) in peer['subver']:
|
||||
result.append(peer['id'])
|
||||
return result
|
||||
|
||||
peer_ids = get_peer_ids()
|
||||
if not peer_ids:
|
||||
logger.warning("disconnect_nodes: {} and {} were not connected".format(
|
||||
from_connection.index,
|
||||
node_num
|
||||
))
|
||||
return
|
||||
for peer_id in peer_ids:
|
||||
try:
|
||||
from_connection.disconnectnode(nodeid=peer_id)
|
||||
except JSONRPCException as e:
|
||||
|
|
@ -413,7 +427,7 @@ def disconnect_nodes(from_connection, node_num):
|
|||
raise
|
||||
|
||||
# wait to disconnect
|
||||
wait_until(lambda: [peer['id'] for peer in from_connection.getpeerinfo() if "testnode%d" % node_num in peer['subver']] == [], timeout=5)
|
||||
wait_until(lambda: not get_peer_ids(), timeout=5)
|
||||
|
||||
def connect_nodes(from_connection, node_num):
|
||||
ip_port = "127.0.0.1:" + str(p2p_port(node_num))
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ class TxnMallTest(BitcoinTestFramework):
|
|||
# Start with split network:
|
||||
super().setup_network()
|
||||
disconnect_nodes(self.nodes[1], 2)
|
||||
disconnect_nodes(self.nodes[2], 1)
|
||||
|
||||
def run_test(self):
|
||||
if self.options.segwit:
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ class TxnMallTest(BitcoinTestFramework):
|
|||
# Start with split network:
|
||||
super().setup_network()
|
||||
disconnect_nodes(self.nodes[1], 2)
|
||||
disconnect_nodes(self.nodes[2], 1)
|
||||
|
||||
def run_test(self):
|
||||
# All nodes should start with 1,250 BTC:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue