mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
Merge #6289: test: avoid node (dis)connections in functional tests that are invalid or likely to fail
40f2ab906c
test: don't attempt to reconnect already connected nodes (Kittywhiskers Van Gogh)4a0fc8b69e
test: don't attempt to (dis)connect nodes to/from themselves (Kittywhiskers Van Gogh) Pull request description: ## Additional Information * Dependency for https://github.com/dashpay/dash/pull/6276 ## Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests - [x] I have made corresponding changes to the documentation **(note: N/A)** - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK40f2ab906c
Tree-SHA512: aaaeedabeb6b8ef77187fc14db1888c39863daf66afda93b8c8bc1dbbdf3ff6734445fd296d5b1034da6104e2d7cfcacf26b97b7be0a697b7a99f3671b6cb9a2
This commit is contained in:
commit
e493d591ca
@ -56,10 +56,6 @@ class DIP3V19Test(DashTestFramework):
|
|||||||
self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn())
|
self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn())
|
||||||
null_hash = format(0, "064x")
|
null_hash = format(0, "064x")
|
||||||
|
|
||||||
for i in range(len(self.nodes)):
|
|
||||||
if i != 0:
|
|
||||||
self.connect_nodes(i, 0)
|
|
||||||
|
|
||||||
self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0)
|
self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0)
|
||||||
self.wait_for_sporks_same()
|
self.wait_for_sporks_same()
|
||||||
|
|
||||||
|
@ -23,13 +23,11 @@ class LLMQChainLocksTest(DashTestFramework):
|
|||||||
self.set_dash_test_params(5, 4)
|
self.set_dash_test_params(5, 4)
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
|
||||||
# Connect all nodes to node1 so that we always have the whole network connected
|
# Connect all nodes to node1 so that we always have the whole network connected
|
||||||
# Otherwise only masternode connections will be established between nodes, which won't propagate TXs/blocks
|
# Otherwise only masternode connections will be established between nodes, which won't propagate TXs/blocks
|
||||||
# Usually node0 is the one that does this, but in this test we isolate it multiple times
|
# Usually node0 is the one that does this, but in this test we isolate it multiple times
|
||||||
for i in range(len(self.nodes)):
|
for i in range(2, len(self.nodes)):
|
||||||
if i != 1:
|
self.connect_nodes(i, 1)
|
||||||
self.connect_nodes(i, 1)
|
|
||||||
|
|
||||||
self.test_coinbase_best_cl(self.nodes[0], expected_cl_in_cb=False)
|
self.test_coinbase_best_cl(self.nodes[0], expected_cl_in_cb=False)
|
||||||
|
|
||||||
|
@ -57,10 +57,6 @@ class LLMQEvoNodesTest(DashTestFramework):
|
|||||||
self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn())
|
self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn())
|
||||||
null_hash = format(0, "064x")
|
null_hash = format(0, "064x")
|
||||||
|
|
||||||
for i in range(len(self.nodes)):
|
|
||||||
if i != 0:
|
|
||||||
self.connect_nodes(i, 0)
|
|
||||||
|
|
||||||
self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0)
|
self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0)
|
||||||
self.nodes[0].sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 1)
|
self.nodes[0].sporkupdate("SPORK_2_INSTANTSEND_ENABLED", 1)
|
||||||
self.wait_for_sporks_same()
|
self.wait_for_sporks_same()
|
||||||
|
@ -64,10 +64,6 @@ class LLMQQuorumRotationTest(DashTestFramework):
|
|||||||
# Otherwise only masternode connections will be established between nodes, which won't propagate TXs/blocks
|
# Otherwise only masternode connections will be established between nodes, which won't propagate TXs/blocks
|
||||||
# Usually node0 is the one that does this, but in this test we isolate it multiple times
|
# Usually node0 is the one that does this, but in this test we isolate it multiple times
|
||||||
|
|
||||||
for i in range(len(self.nodes)):
|
|
||||||
if i != 1:
|
|
||||||
self.connect_nodes(i, 0)
|
|
||||||
|
|
||||||
self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0)
|
self.nodes[0].sporkupdate("SPORK_17_QUORUM_DKG_ENABLED", 0)
|
||||||
self.wait_for_sporks_same()
|
self.wait_for_sporks_same()
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class MnehfTest(DashTestFramework):
|
|||||||
self.stop_node(index)
|
self.stop_node(index)
|
||||||
self.start_masternode(mn)
|
self.start_masternode(mn)
|
||||||
for i in range(1, self.num_nodes):
|
for i in range(1, self.num_nodes):
|
||||||
self.connect_nodes(i, 0)
|
self.connect_nodes(i, 0)
|
||||||
|
|
||||||
def slowly_generate_batch(self, amount):
|
def slowly_generate_batch(self, amount):
|
||||||
self.log.info(f"Slowly generate {amount} blocks")
|
self.log.info(f"Slowly generate {amount} blocks")
|
||||||
|
@ -213,7 +213,6 @@ class NetTest(DashTestFramework):
|
|||||||
|
|
||||||
self.log.info('Test extended connections info')
|
self.log.info('Test extended connections info')
|
||||||
# Connect nodes both ways.
|
# Connect nodes both ways.
|
||||||
self.connect_nodes(0, 1)
|
|
||||||
self.connect_nodes(1, 0)
|
self.connect_nodes(1, 0)
|
||||||
|
|
||||||
assert_equal(self.nodes[1].getnetworkinfo()['connections'], 2)
|
assert_equal(self.nodes[1].getnetworkinfo()['connections'], 2)
|
||||||
|
@ -692,6 +692,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||||||
self.nodes[i].process.wait(timeout)
|
self.nodes[i].process.wait(timeout)
|
||||||
|
|
||||||
def connect_nodes(self, a, b):
|
def connect_nodes(self, a, b):
|
||||||
|
# A node cannot connect to itself, bail out early
|
||||||
|
if (a == b):
|
||||||
|
return
|
||||||
|
|
||||||
def connect_nodes_helper(from_connection, node_num):
|
def connect_nodes_helper(from_connection, node_num):
|
||||||
ip_port = "127.0.0.1:" + str(p2p_port(node_num))
|
ip_port = "127.0.0.1:" + str(p2p_port(node_num))
|
||||||
from_connection.addnode(ip_port, "onetry")
|
from_connection.addnode(ip_port, "onetry")
|
||||||
@ -706,6 +710,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||||||
connect_nodes_helper(self.nodes[a], b)
|
connect_nodes_helper(self.nodes[a], b)
|
||||||
|
|
||||||
def disconnect_nodes(self, a, b):
|
def disconnect_nodes(self, a, b):
|
||||||
|
# A node cannot disconnect from itself, bail out early
|
||||||
|
if (a == b):
|
||||||
|
return
|
||||||
|
|
||||||
def disconnect_nodes_helper(from_connection, node_num):
|
def disconnect_nodes_helper(from_connection, node_num):
|
||||||
def get_peer_ids():
|
def get_peer_ids():
|
||||||
result = []
|
result = []
|
||||||
|
Loading…
Reference in New Issue
Block a user