mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
refactor: test: improve wait_for{header,merkleblock} interface
The interfaces for the methods wait_for_header() and wait_for_merkleblock() are changed to take a hex string instead of an integer, improving type safety and removing the burden from the caller to always do the transformation via `int(...)`. As suggested by MarcoFalke in https://github.com/bitcoin/bitcoin/pull/18593#discussion_r407062253
This commit is contained in:
@@ -393,7 +393,7 @@ class P2PInterface(P2PConnection):
|
||||
last_headers = self.last_message.get('headers')
|
||||
if not last_headers:
|
||||
return False
|
||||
return last_headers.headers[0].rehash() == blockhash
|
||||
return last_headers.headers[0].rehash() == int(blockhash, 16)
|
||||
|
||||
wait_until(test_function, timeout=timeout, lock=mininode_lock)
|
||||
|
||||
@@ -403,7 +403,7 @@ class P2PInterface(P2PConnection):
|
||||
last_filtered_block = self.last_message.get('merkleblock')
|
||||
if not last_filtered_block:
|
||||
return False
|
||||
return last_filtered_block.merkleblock.header.rehash() == blockhash
|
||||
return last_filtered_block.merkleblock.header.rehash() == int(blockhash, 16)
|
||||
|
||||
wait_until(test_function, timeout=timeout, lock=mininode_lock)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user