aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-08-08 17:22:45 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-08-08 17:22:35 -0400
commitfa5587fe71ce041dc69cb0d46697975bb51ef1f6 (patch)
treeed1eb744ee32af6b25a90d4557b3af1c3ee62d34
parent1cd5f2cf9a98708767049a7ddf577cc3f4527617 (diff)
downloadbitcoin-fa5587fe71ce041dc69cb0d46697975bb51ef1f6.tar.xz
qa: wait_for_verack by default
-rwxr-xr-xtest/functional/example_test.py6
-rwxr-xr-xtest/functional/feature_assumevalid.py7
-rwxr-xr-xtest/functional/feature_cltv.py1
-rwxr-xr-xtest/functional/feature_csv_activation.py1
-rwxr-xr-xtest/functional/feature_dersig.py3
-rwxr-xr-xtest/functional/feature_maxuploadtarget.py6
-rwxr-xr-xtest/functional/feature_versionbits_warning.py2
-rwxr-xr-xtest/functional/p2p_compactblocks.py4
-rwxr-xr-xtest/functional/p2p_feefilter.py2
-rwxr-xr-xtest/functional/p2p_fingerprint.py1
-rwxr-xr-xtest/functional/p2p_invalid_block.py1
-rwxr-xr-xtest/functional/p2p_invalid_tx.py1
-rwxr-xr-xtest/functional/p2p_leak.py6
-rwxr-xr-xtest/functional/p2p_mempool.py1
-rwxr-xr-xtest/functional/p2p_node_network_limited.py2
-rwxr-xr-xtest/functional/p2p_segwit.py3
-rwxr-xr-xtest/functional/p2p_sendheaders.py2
-rwxr-xr-xtest/functional/p2p_timeouts.py4
-rwxr-xr-xtest/functional/p2p_unrequested_blocks.py4
-rwxr-xr-xtest/functional/rpc_blockchain.py4
-rwxr-xr-xtest/functional/test_framework/test_node.py6
21 files changed, 11 insertions, 56 deletions
diff --git a/test/functional/example_test.py b/test/functional/example_test.py
index e2f1cc05b3..b9e1a4b682 100755
--- a/test/functional/example_test.py
+++ b/test/functional/example_test.py
@@ -130,12 +130,9 @@ class ExampleTest(BitcoinTestFramework):
def run_test(self):
"""Main test logic"""
- # Create P2P connections to two of the nodes
+ # Create P2P connections will wait for a verack to make sure the connection is fully up
self.nodes[0].add_p2p_connection(BaseNode())
- # wait_for_verack ensures that the P2P connection is fully up.
- self.nodes[0].p2p.wait_for_verack()
-
# Generating a block on one of the nodes will get us out of IBD
blocks = [int(self.nodes[0].generate(nblocks=1)[0], 16)]
self.sync_all([self.nodes[0:1]])
@@ -187,7 +184,6 @@ class ExampleTest(BitcoinTestFramework):
self.nodes[0].disconnect_p2ps()
self.nodes[2].add_p2p_connection(BaseNode())
- self.nodes[2].p2p.wait_for_verack()
self.log.info("Wait for node2 reach current tip. Test that it has propagated all the blocks to us")
diff --git a/test/functional/feature_assumevalid.py b/test/functional/feature_assumevalid.py
index 933a4740dd..c5b58f71f0 100755
--- a/test/functional/feature_assumevalid.py
+++ b/test/functional/feature_assumevalid.py
@@ -95,10 +95,7 @@ class AssumeValidTest(BitcoinTestFramework):
break
def run_test(self):
-
- # Connect to node0
p2p0 = self.nodes[0].add_p2p_connection(BaseNode())
- self.nodes[0].p2p.wait_for_verack()
# Build the blockchain
self.tip = int(self.nodes[0].getbestblockhash(), 16)
@@ -168,10 +165,6 @@ class AssumeValidTest(BitcoinTestFramework):
p2p1 = self.nodes[1].add_p2p_connection(BaseNode())
p2p2 = self.nodes[2].add_p2p_connection(BaseNode())
- p2p0.wait_for_verack()
- p2p1.wait_for_verack()
- p2p2.wait_for_verack()
-
# send header lists to all three nodes
p2p0.send_header_for_blocks(self.blocks[0:2000])
p2p0.send_header_for_blocks(self.blocks[2000:])
diff --git a/test/functional/feature_cltv.py b/test/functional/feature_cltv.py
index 10f8b92a8f..623b540add 100755
--- a/test/functional/feature_cltv.py
+++ b/test/functional/feature_cltv.py
@@ -67,7 +67,6 @@ class BIP65Test(BitcoinTestFramework):
def run_test(self):
self.nodes[0].add_p2p_connection(P2PInterface())
- self.nodes[0].p2p.wait_for_verack()
self.log.info("Mining %d blocks", CLTV_HEIGHT - 2)
self.coinbase_blocks = self.nodes[0].generate(CLTV_HEIGHT - 2)
diff --git a/test/functional/feature_csv_activation.py b/test/functional/feature_csv_activation.py
index 2499214fbd..06a8c69712 100755
--- a/test/functional/feature_csv_activation.py
+++ b/test/functional/feature_csv_activation.py
@@ -183,7 +183,6 @@ class BIP68_112_113Test(BitcoinTestFramework):
def run_test(self):
self.nodes[0].add_p2p_connection(P2PDataStore())
- self.nodes[0].p2p.wait_for_verack()
self.log.info("Generate blocks in the past for coinbase outputs.")
long_past_time = int(time.time()) - 600 * 1000 # enough to build up to 1000 blocks 10 minutes apart without worrying about getting into the future
diff --git a/test/functional/feature_dersig.py b/test/functional/feature_dersig.py
index 4337d42dc0..47dc6754bf 100755
--- a/test/functional/feature_dersig.py
+++ b/test/functional/feature_dersig.py
@@ -57,9 +57,6 @@ class BIP66Test(BitcoinTestFramework):
def run_test(self):
self.nodes[0].add_p2p_connection(P2PInterface())
- # wait_for_verack ensures that the P2P connection is fully up.
- self.nodes[0].p2p.wait_for_verack()
-
self.log.info("Mining %d blocks", DERSIG_HEIGHT - 2)
self.coinbase_blocks = self.nodes[0].generate(DERSIG_HEIGHT - 2)
self.nodeaddress = self.nodes[0].getnewaddress()
diff --git a/test/functional/feature_maxuploadtarget.py b/test/functional/feature_maxuploadtarget.py
index c413ecf705..273c8d92c4 100755
--- a/test/functional/feature_maxuploadtarget.py
+++ b/test/functional/feature_maxuploadtarget.py
@@ -57,11 +57,6 @@ class MaxUploadTest(BitcoinTestFramework):
for _ in range(3):
p2p_conns.append(self.nodes[0].add_p2p_connection(TestP2PConn()))
- for p2pc in p2p_conns:
- p2pc.wait_for_verack()
-
- # Test logic begins here
-
# Now mine a big block
mine_large_block(self.nodes[0], self.utxo_cache)
@@ -147,7 +142,6 @@ class MaxUploadTest(BitcoinTestFramework):
# Reconnect to self.nodes[0]
self.nodes[0].add_p2p_connection(TestP2PConn())
- self.nodes[0].p2p.wait_for_verack()
#retrieve 20 blocks which should be enough to break the 1MB limit
getdata_request.inv = [CInv(2, big_new_block)]
diff --git a/test/functional/feature_versionbits_warning.py b/test/functional/feature_versionbits_warning.py
index a03c20b088..4d359da20b 100755
--- a/test/functional/feature_versionbits_warning.py
+++ b/test/functional/feature_versionbits_warning.py
@@ -62,10 +62,8 @@ class VersionBitsWarningTest(BitcoinTestFramework):
return VB_PATTERN.search(alert_text) is not None
def run_test(self):
- # Handy alias
node = self.nodes[0]
node.add_p2p_connection(P2PInterface())
- node.p2p.wait_for_verack()
# Mine one period worth of blocks
node.generate(VB_PERIOD)
diff --git a/test/functional/p2p_compactblocks.py b/test/functional/p2p_compactblocks.py
index 17aacd8152..bb19ec7c72 100755
--- a/test/functional/p2p_compactblocks.py
+++ b/test/functional/p2p_compactblocks.py
@@ -790,11 +790,9 @@ class CompactBlocksTest(BitcoinTestFramework):
def run_test(self):
# Setup the p2p connections
self.test_node = self.nodes[0].add_p2p_connection(TestP2PConn())
- self.segwit_node = self.nodes[1].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK|NODE_WITNESS)
+ self.segwit_node = self.nodes[1].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK | NODE_WITNESS)
self.old_node = self.nodes[1].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK)
- self.test_node.wait_for_verack()
-
# We will need UTXOs to construct transactions in later tests.
self.make_utxos()
diff --git a/test/functional/p2p_feefilter.py b/test/functional/p2p_feefilter.py
index 5b3fa0186a..08d512ef10 100755
--- a/test/functional/p2p_feefilter.py
+++ b/test/functional/p2p_feefilter.py
@@ -47,9 +47,7 @@ class FeeFilterTest(BitcoinTestFramework):
node1.generate(1)
sync_blocks(self.nodes)
- # Setup the p2p connections
self.nodes[0].add_p2p_connection(TestP2PConn())
- self.nodes[0].p2p.wait_for_verack()
# Test that invs are received for all txs at feerate of 20 sat/byte
node1.settxfee(Decimal("0.00020000"))
diff --git a/test/functional/p2p_fingerprint.py b/test/functional/p2p_fingerprint.py
index 61f9ec014b..b872bacbdc 100755
--- a/test/functional/p2p_fingerprint.py
+++ b/test/functional/p2p_fingerprint.py
@@ -75,7 +75,6 @@ class P2PFingerprintTest(BitcoinTestFramework):
# last month but that have over a month's worth of work are also withheld.
def run_test(self):
node0 = self.nodes[0].add_p2p_connection(P2PInterface())
- node0.wait_for_verack()
# Set node time to 60 days ago
self.nodes[0].setmocktime(int(time.time()) - 60 * 24 * 60 * 60)
diff --git a/test/functional/p2p_invalid_block.py b/test/functional/p2p_invalid_block.py
index c981968026..58ae881f2f 100755
--- a/test/functional/p2p_invalid_block.py
+++ b/test/functional/p2p_invalid_block.py
@@ -28,7 +28,6 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
# Add p2p connection to node0
node = self.nodes[0] # convenience reference to the node
node.add_p2p_connection(P2PDataStore())
- node.p2p.wait_for_verack()
best_block = node.getblock(node.getbestblockhash())
tip = int(node.getbestblockhash(), 16)
diff --git a/test/functional/p2p_invalid_tx.py b/test/functional/p2p_invalid_tx.py
index a7a86f89fd..5c7ae97dd9 100755
--- a/test/functional/p2p_invalid_tx.py
+++ b/test/functional/p2p_invalid_tx.py
@@ -32,7 +32,6 @@ class InvalidTxRequestTest(BitcoinTestFramework):
Helper to connect and wait for version handshake."""
for _ in range(num_connections):
self.nodes[0].add_p2p_connection(P2PDataStore())
- self.nodes[0].p2p.wait_for_verack()
def reconnect_p2p(self, **kwargs):
"""Tear down and bootstrap the P2P connection to the node.
diff --git a/test/functional/p2p_leak.py b/test/functional/p2p_leak.py
index 186c35e0e1..ab404d6ba5 100755
--- a/test/functional/p2p_leak.py
+++ b/test/functional/p2p_leak.py
@@ -88,11 +88,11 @@ class CNodeNoVerackIdle(CLazyNode):
class P2PLeakTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
- self.extra_args = [['-banscore='+str(banscore)]]
+ self.extra_args = [['-banscore=' + str(banscore)]]
def run_test(self):
- no_version_bannode = self.nodes[0].add_p2p_connection(CNodeNoVersionBan(), send_version=False)
- no_version_idlenode = self.nodes[0].add_p2p_connection(CNodeNoVersionIdle(), send_version=False)
+ no_version_bannode = self.nodes[0].add_p2p_connection(CNodeNoVersionBan(), send_version=False, wait_for_verack=False)
+ no_version_idlenode = self.nodes[0].add_p2p_connection(CNodeNoVersionIdle(), send_version=False, wait_for_verack=False)
no_verack_idlenode = self.nodes[0].add_p2p_connection(CNodeNoVerackIdle())
wait_until(lambda: no_version_bannode.ever_connected, timeout=10, lock=mininode_lock)
diff --git a/test/functional/p2p_mempool.py b/test/functional/p2p_mempool.py
index 5a1fb60fb5..e90320ef0b 100755
--- a/test/functional/p2p_mempool.py
+++ b/test/functional/p2p_mempool.py
@@ -21,7 +21,6 @@ class P2PMempoolTests(BitcoinTestFramework):
def run_test(self):
# Add a p2p connection
self.nodes[0].add_p2p_connection(P2PInterface())
- self.nodes[0].p2p.wait_for_verack()
#request mempool
self.nodes[0].p2p.send_message(msg_mempool())
diff --git a/test/functional/p2p_node_network_limited.py b/test/functional/p2p_node_network_limited.py
index 4a24e24daf..fb1d3b7545 100755
--- a/test/functional/p2p_node_network_limited.py
+++ b/test/functional/p2p_node_network_limited.py
@@ -48,7 +48,6 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
def run_test(self):
node = self.nodes[0].add_p2p_connection(P2PIgnoreInv())
- node.wait_for_verack()
expected_services = NODE_BLOOM | NODE_WITNESS | NODE_NETWORK_LIMITED
@@ -74,7 +73,6 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
self.log.info("Check local address relay, do a fresh connection.")
self.nodes[0].disconnect_p2ps()
node1 = self.nodes[0].add_p2p_connection(P2PIgnoreInv())
- node1.wait_for_verack()
node1.send_message(msg_verack())
node1.wait_for_addr()
diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py
index 52f6482d56..4231774ce7 100755
--- a/test/functional/p2p_segwit.py
+++ b/test/functional/p2p_segwit.py
@@ -231,9 +231,6 @@ class SegWitTest(BitcoinTestFramework):
# self.std_node is for testing node1 (fRequireStandard=true)
self.std_node = self.nodes[1].add_p2p_connection(TestP2PConn(), services=NODE_NETWORK | NODE_WITNESS)
- for conn in (self.test_node, self.old_node, self.std_node):
- conn.wait_for_verack()
-
assert self.test_node.nServices & NODE_WITNESS != 0
# Keep a place to store utxo's that can be used in later tests
diff --git a/test/functional/p2p_sendheaders.py b/test/functional/p2p_sendheaders.py
index 2788d8995e..52f539b264 100755
--- a/test/functional/p2p_sendheaders.py
+++ b/test/functional/p2p_sendheaders.py
@@ -242,8 +242,6 @@ class SendHeadersTest(BitcoinTestFramework):
# Make sure NODE_NETWORK is not set for test_node, so no block download
# will occur outside of direct fetching
test_node = self.nodes[0].add_p2p_connection(BaseNode(), services=NODE_WITNESS)
- inv_node.wait_for_verack()
- test_node.wait_for_verack()
# Ensure verack's have been processed by our peer
inv_node.sync_with_ping()
diff --git a/test/functional/p2p_timeouts.py b/test/functional/p2p_timeouts.py
index 7a4ef1c05c..7abd5fab8e 100755
--- a/test/functional/p2p_timeouts.py
+++ b/test/functional/p2p_timeouts.py
@@ -40,8 +40,8 @@ class TimeoutsTest(BitcoinTestFramework):
def run_test(self):
# Setup the p2p connections
no_verack_node = self.nodes[0].add_p2p_connection(TestP2PConn())
- no_version_node = self.nodes[0].add_p2p_connection(TestP2PConn(), send_version=False)
- no_send_node = self.nodes[0].add_p2p_connection(TestP2PConn(), send_version=False)
+ no_version_node = self.nodes[0].add_p2p_connection(TestP2PConn(), send_version=False, wait_for_verack=False)
+ no_send_node = self.nodes[0].add_p2p_connection(TestP2PConn(), send_version=False, wait_for_verack=False)
sleep(1)
diff --git a/test/functional/p2p_unrequested_blocks.py b/test/functional/p2p_unrequested_blocks.py
index 5f2d65c3f5..03a47950ca 100755
--- a/test/functional/p2p_unrequested_blocks.py
+++ b/test/functional/p2p_unrequested_blocks.py
@@ -78,8 +78,6 @@ class AcceptBlockTest(BitcoinTestFramework):
test_node = self.nodes[0].add_p2p_connection(P2PInterface())
# min_work_node connects to node1 (whitelisted)
min_work_node = self.nodes[1].add_p2p_connection(P2PInterface())
- test_node.wait_for_verack()
- min_work_node.wait_for_verack()
# 1. Have nodes mine a block (leave IBD)
[ n.generate(1) for n in self.nodes ]
@@ -202,7 +200,6 @@ class AcceptBlockTest(BitcoinTestFramework):
self.nodes[1].disconnect_p2ps()
test_node = self.nodes[0].add_p2p_connection(P2PInterface())
- test_node.wait_for_verack()
test_node.send_message(msg_block(block_h1f))
@@ -287,7 +284,6 @@ class AcceptBlockTest(BitcoinTestFramework):
self.nodes[0].disconnect_p2ps()
test_node = self.nodes[0].add_p2p_connection(P2PInterface())
- test_node.wait_for_verack()
# We should have failed reorg and switched back to 290 (but have block 291)
assert_equal(self.nodes[0].getblockcount(), 290)
diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py
index 155d30317a..cfc9958875 100755
--- a/test/functional/rpc_blockchain.py
+++ b/test/functional/rpc_blockchain.py
@@ -256,12 +256,8 @@ class BlockchainTest(BitcoinTestFramework):
def _test_waitforblockheight(self):
self.log.info("Test waitforblockheight")
-
node = self.nodes[0]
-
- # Start a P2P connection since we'll need to create some blocks.
node.add_p2p_connection(P2PInterface())
- node.p2p.wait_for_verack()
current_height = node.getblock(node.getbestblockhash())['height']
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index 8ae7677f3b..f90f5affc2 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -276,7 +276,7 @@ class TestNode():
self.encryptwallet(passphrase)
self.wait_until_stopped()
- def add_p2p_connection(self, p2p_conn, *args, **kwargs):
+ def add_p2p_connection(self, p2p_conn, *, wait_for_verack=True, **kwargs):
"""Add a p2p connection to the node.
This method adds the p2p connection to the self.p2ps list and also
@@ -286,8 +286,10 @@ class TestNode():
if 'dstaddr' not in kwargs:
kwargs['dstaddr'] = '127.0.0.1'
- p2p_conn.peer_connect(*args, **kwargs)()
+ p2p_conn.peer_connect(**kwargs)()
self.p2ps.append(p2p_conn)
+ if wait_for_verack:
+ p2p_conn.wait_for_verack()
return p2p_conn