diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2021-12-08 18:34:21 +0700 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2021-12-09 15:49:37 +0700 |
commit | bfbf91d0b2004dde358253ac174982f784b43b59 (patch) | |
tree | 6c8920977c4581ded021afbae9369e6d1ea2f9f0 /test/functional/rpc_getblockfrompeer.py | |
parent | 529ed3336205e30d94e741a4eb93dd945ad518e7 (diff) |
test: fancier Python for getblockfrompeer
Co-authored-by: MarcoFalke <falke.marco@gmail.com>
Diffstat (limited to 'test/functional/rpc_getblockfrompeer.py')
-rwxr-xr-x | test/functional/rpc_getblockfrompeer.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/test/functional/rpc_getblockfrompeer.py b/test/functional/rpc_getblockfrompeer.py index e841cba70e..47be920532 100755 --- a/test/functional/rpc_getblockfrompeer.py +++ b/test/functional/rpc_getblockfrompeer.py @@ -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") |