aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_block.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-04-10 18:08:01 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-04-16 23:11:27 -0400
commitfadfbd33ab4ea57f1efa2d10a346c25c4ad18b58 (patch)
tree9e35ac3835ab85dccbaa4024d7993546e214f5ef /test/functional/feature_block.py
parent6a278e06400934df0fc6ed81b0d7c645efc50bdf (diff)
qa: Add test for orphan handling
Diffstat (limited to 'test/functional/feature_block.py')
-rwxr-xr-xtest/functional/feature_block.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/test/functional/feature_block.py b/test/functional/feature_block.py
index 181c7f3369..5959a8a541 100755
--- a/test/functional/feature_block.py
+++ b/test/functional/feature_block.py
@@ -82,10 +82,7 @@ class FullBlockTest(BitcoinTestFramework):
def run_test(self):
node = self.nodes[0] # convenience reference to the node
- # reconnect_p2p() expects the network thread to be running
- network_thread_start()
-
- self.reconnect_p2p()
+ self.bootstrap_p2p() # Add one p2p connection to the node
self.block_heights = {}
self.coinbase_key = CECKey()
@@ -1296,18 +1293,23 @@ class FullBlockTest(BitcoinTestFramework):
self.blocks[block_number] = block
return block
- def reconnect_p2p(self):
+ def bootstrap_p2p(self):
"""Add a P2P connection to the node.
- The node gets disconnected several times in this test. This helper
- method reconnects the p2p and restarts the network thread."""
-
- network_thread_join()
- self.nodes[0].disconnect_p2ps()
+ Helper to connect and wait for version handshake."""
self.nodes[0].add_p2p_connection(P2PDataStore())
network_thread_start()
self.nodes[0].p2p.wait_for_verack()
+ def reconnect_p2p(self):
+ """Tear down and bootstrap the P2P connection to the node.
+
+ The node gets disconnected several times in this test. This helper
+ method reconnects the p2p and restarts the network thread."""
+ self.nodes[0].disconnect_p2ps()
+ network_thread_join()
+ self.bootstrap_p2p()
+
def sync_blocks(self, blocks, success=True, reject_code=None, reject_reason=None, request_block=True, reconnect=False, timeout=60):
"""Sends blocks to test node. Syncs and verifies that tip has advanced to most recent block.