diff options
author | mrbandrews <bandrewsny@gmail.com> | 2016-10-26 10:53:46 -0400 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2016-11-07 17:38:22 -0500 |
commit | d768f151f63eb3bb505676bca07be24da151f6b2 (patch) | |
tree | d3e90384e866fe1fa42a15ed0b50d06f04185fdd /qa/rpc-tests | |
parent | 9f554e03ebe5701c1b75ff03b3d6152095c0cad3 (diff) |
[qa] Make comptool push blocks instead of relying on inv-fetch
Diffstat (limited to 'qa/rpc-tests')
-rwxr-xr-x | qa/rpc-tests/test_framework/comptool.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/qa/rpc-tests/test_framework/comptool.py b/qa/rpc-tests/test_framework/comptool.py index 7c92d3f828..17679fc7e1 100755 --- a/qa/rpc-tests/test_framework/comptool.py +++ b/qa/rpc-tests/test_framework/comptool.py @@ -111,6 +111,11 @@ class TestNode(NodeConnCB): m.locator = self.block_store.get_locator(self.bestblockhash) self.conn.send_message(m) + def send_header(self, header): + m = msg_headers() + m.headers.append(header) + self.conn.send_message(m) + # This assumes BIP31 def send_ping(self, nonce): self.pingMap[nonce] = True @@ -345,8 +350,16 @@ class TestManager(object): # Either send inv's to each node and sync, or add # to invqueue for later inv'ing. if (test_instance.sync_every_block): - [ c.cb.send_inv(block) for c in self.connections ] - self.sync_blocks(block.sha256, 1) + # if we expect success, send inv and sync every block + # if we expect failure, just push the block and see what happens. + if outcome == True: + [ c.cb.send_inv(block) for c in self.connections ] + self.sync_blocks(block.sha256, 1) + else: + [ c.send_message(msg_block(block)) for c in self.connections ] + [ c.cb.send_ping(self.ping_counter) for c in self.connections ] + self.wait_for_pings(self.ping_counter) + self.ping_counter += 1 if (not self.check_results(tip, outcome)): raise AssertionError("Test failed at test %d" % test_number) else: @@ -354,6 +367,8 @@ class TestManager(object): elif isinstance(b_or_t, CBlockHeader): block_header = b_or_t self.block_store.add_header(block_header) + [ c.cb.send_header(block_header) for c in self.connections ] + else: # Tx test runner assert(isinstance(b_or_t, CTransaction)) tx = b_or_t |