mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-12 19:20:42 +02:00
QA: Use addconnection rather than addnode onetry
This commit is contained in:
parent
7ab4fecd0f
commit
7137ef57b5
@ -1412,7 +1412,7 @@ class FullBlockTest(BitcoinTestFramework):
|
||||
"""Add a P2P connection to the node.
|
||||
|
||||
Helper to connect and wait for version handshake."""
|
||||
self.helper_peer = self.nodes[0].add_p2p_connection(P2PDataStore(), node_outgoing=True)
|
||||
self.helper_peer = self.nodes[0].add_outbound_p2p_connection(P2PDataStore(), p2p_idx=0)
|
||||
# We need to wait for the initial getheaders from the peer before we
|
||||
# start populating our blockstore. If we don't, then we may run ahead
|
||||
# to the next subtest before we receive the getheaders. We'd then send
|
||||
|
@ -47,7 +47,7 @@ class RejectLowDifficultyHeadersTest(BitcoinTestFramework):
|
||||
self.headers_fork = [from_hex(CBlockHeader(), h) for h in self.headers_fork]
|
||||
|
||||
self.log.info("Feed all non-fork headers, including and up to the first checkpoint")
|
||||
peer_checkpoint = self.nodes[0].add_p2p_connection(P2PInterface(), node_outgoing=True)
|
||||
peer_checkpoint = self.nodes[0].add_outbound_p2p_connection(P2PInterface(), p2p_idx=0)
|
||||
peer_checkpoint.send_and_ping(msg_headers(self.headers))
|
||||
assert {
|
||||
'height': 546,
|
||||
@ -64,7 +64,7 @@ class RejectLowDifficultyHeadersTest(BitcoinTestFramework):
|
||||
self.log.info("Feed all fork headers (succeeds without checkpoint)")
|
||||
# On node 0 it succeeds because checkpoints are disabled
|
||||
self.restart_node(0, extra_args=['-nocheckpoints', "-minimumchainwork=0x0", '-prune=550'])
|
||||
peer_no_checkpoint = self.nodes[0].add_p2p_connection(P2PInterface(), node_outgoing=True)
|
||||
peer_no_checkpoint = self.nodes[0].add_outbound_p2p_connection(P2PInterface(), p2p_idx=0)
|
||||
peer_no_checkpoint.send_and_ping(msg_headers(self.headers_fork))
|
||||
assert {
|
||||
"height": 2,
|
||||
@ -74,7 +74,7 @@ class RejectLowDifficultyHeadersTest(BitcoinTestFramework):
|
||||
} in self.nodes[0].getchaintips()
|
||||
|
||||
# On node 1 it succeeds because no checkpoint has been reached yet by a chain tip
|
||||
peer_before_checkpoint = self.nodes[1].add_p2p_connection(P2PInterface(), node_outgoing=True)
|
||||
peer_before_checkpoint = self.nodes[1].add_outbound_p2p_connection(P2PInterface(), p2p_idx=1)
|
||||
peer_before_checkpoint.send_and_ping(msg_headers(self.headers_fork))
|
||||
assert {
|
||||
"height": 2,
|
||||
|
@ -33,8 +33,8 @@ class InvalidTxRequestTest(BitcoinTestFramework):
|
||||
"""Add a P2P connection to the node.
|
||||
|
||||
Helper to connect and wait for version handshake."""
|
||||
for _ in range(num_connections):
|
||||
self.nodes[0].add_p2p_connection(P2PDataStore(), node_outgoing=True)
|
||||
for i in range(num_connections):
|
||||
self.nodes[0].add_outbound_p2p_connection(P2PDataStore(), p2p_idx=i)
|
||||
|
||||
def reconnect_p2p(self, **kwargs):
|
||||
"""Tear down and bootstrap the P2P connection to the node.
|
||||
|
@ -80,7 +80,7 @@ class AcceptBlockTest(BitcoinTestFramework):
|
||||
return False
|
||||
|
||||
def run_test(self):
|
||||
test_node = self.nodes[0].add_p2p_connection(P2PInterface(), node_outgoing=True)
|
||||
test_node = self.nodes[0].add_outbound_p2p_connection(P2PInterface(), p2p_idx=0)
|
||||
min_work_node = self.nodes[1].add_p2p_connection(P2PInterface())
|
||||
|
||||
# 1. Have nodes mine a block (leave IBD)
|
||||
@ -203,7 +203,7 @@ class AcceptBlockTest(BitcoinTestFramework):
|
||||
self.nodes[0].disconnect_p2ps()
|
||||
self.nodes[1].disconnect_p2ps()
|
||||
|
||||
test_node = self.nodes[0].add_p2p_connection(P2PInterface(), node_outgoing=True)
|
||||
test_node = self.nodes[0].add_outbound_p2p_connection(P2PInterface(), p2p_idx=2)
|
||||
|
||||
test_node.send_and_ping(msg_block(block_h1f))
|
||||
assert_equal(self.nodes[0].getblockcount(), 2)
|
||||
@ -275,7 +275,7 @@ class AcceptBlockTest(BitcoinTestFramework):
|
||||
test_node.wait_for_disconnect()
|
||||
|
||||
self.nodes[0].disconnect_p2ps()
|
||||
test_node = self.nodes[0].add_p2p_connection(P2PInterface(), node_outgoing=True)
|
||||
test_node = self.nodes[0].add_outbound_p2p_connection(P2PInterface(), p2p_idx=3)
|
||||
|
||||
# We should have failed reorg and switched back to 290 (but have block 291)
|
||||
assert_equal(self.nodes[0].getblockcount(), 290)
|
||||
|
Loading…
Reference in New Issue
Block a user