Waits for a getheaders message containing a specific block hash. If no block hash is provided, checks whether any getheaders message has been received by the node.
(self, block_hash=None, *, timeout=60)
| 669 | self.wait_until(test_function, timeout=timeout) |
| 670 | |
| 671 | def wait_for_getheaders(self, block_hash=None, *, timeout=60): |
| 672 | """Waits for a getheaders message containing a specific block hash. |
| 673 | |
| 674 | If no block hash is provided, checks whether any getheaders message has been received by the node.""" |
| 675 | def test_function(): |
| 676 | last_getheaders = self.last_message.pop("getheaders", None) |
| 677 | if block_hash is None: |
| 678 | return last_getheaders |
| 679 | if last_getheaders is None: |
| 680 | return False |
| 681 | return block_hash == last_getheaders.locator.vHave[0] |
| 682 | |
| 683 | self.wait_until(test_function, timeout=timeout) |
| 684 | |
| 685 | def wait_for_inv(self, expected_inv, *, timeout=60): |
| 686 | """Waits for an INV message and checks that the first inv object in the message was as expected.""" |