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:
    utACK 40f2ab906c

Tree-SHA512: aaaeedabeb6b8ef77187fc14db1888c39863daf66afda93b8c8bc1dbbdf3ff6734445fd296d5b1034da6104e2d7cfcacf26b97b7be0a697b7a99f3671b6cb9a2
This commit is contained in:
pasta 2024-10-01 09:41:15 -05:00
commit e493d591ca
No known key found for this signature in database
GPG Key ID: E2F3D7916E722D38
7 changed files with 11 additions and 18 deletions

View File

@ -56,10 +56,6 @@ class DIP3V19Test(DashTestFramework):
self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn())
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.wait_for_sporks_same()

View File

@ -23,12 +23,10 @@ class LLMQChainLocksTest(DashTestFramework):
self.set_dash_test_params(5, 4)
def run_test(self):
# 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
# 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:
for i in range(2, len(self.nodes)):
self.connect_nodes(i, 1)
self.test_coinbase_best_cl(self.nodes[0], expected_cl_in_cb=False)

View File

@ -57,10 +57,6 @@ class LLMQEvoNodesTest(DashTestFramework):
self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn())
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_2_INSTANTSEND_ENABLED", 1)
self.wait_for_sporks_same()

View File

@ -64,10 +64,6 @@ class LLMQQuorumRotationTest(DashTestFramework):
# 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
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.wait_for_sporks_same()

View File

@ -213,7 +213,6 @@ class NetTest(DashTestFramework):
self.log.info('Test extended connections info')
# Connect nodes both ways.
self.connect_nodes(0, 1)
self.connect_nodes(1, 0)
assert_equal(self.nodes[1].getnetworkinfo()['connections'], 2)

View File

@ -692,6 +692,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
self.nodes[i].process.wait(timeout)
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):
ip_port = "127.0.0.1:" + str(p2p_port(node_num))
from_connection.addnode(ip_port, "onetry")
@ -706,6 +710,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
connect_nodes_helper(self.nodes[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 get_peer_ids():
result = []