test: fancier Python for getblockfrompeer

Co-authored-by: MarcoFalke <falke.marco@gmail.com>
This commit is contained in:
Sjors Provoost 2021-12-08 18:34:21 +07:00
parent 529ed33362
commit bfbf91d0b2
No known key found for this signature in database
GPG key ID: 57FF9BDBCC301009

View file

@ -40,12 +40,8 @@ class GetBlockFromPeerTest(BitcoinTestFramework):
self.sync_blocks()
self.log.info("Node 0 should only have the header for node 1's block 3")
for x in self.nodes[0].getchaintips():
if x['hash'] == short_tip:
assert_equal(x['status'], "headers-only")
break
else:
raise AssertionError("short tip not synced")
x = next(filter(lambda x: x['hash'] == short_tip, self.nodes[0].getchaintips()))
assert_equal(x['status'], "headers-only")
assert_raises_rpc_error(-1, "Block not found on disk", self.nodes[0].getblock, short_tip)
self.log.info("Fetch block from node 1")