From bfbf91d0b2004dde358253ac174982f784b43b59 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Wed, 8 Dec 2021 18:34:21 +0700 Subject: [PATCH] test: fancier Python for getblockfrompeer Co-authored-by: MarcoFalke --- test/functional/rpc_getblockfrompeer.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/test/functional/rpc_getblockfrompeer.py b/test/functional/rpc_getblockfrompeer.py index e841cba70e430..47be920532d7d 100755 --- a/test/functional/rpc_getblockfrompeer.py +++ b/test/functional/rpc_getblockfrompeer.py @@ -40,12 +40,8 @@ def run_test(self): 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")