Beispiel #1
0
    async def __call__(
            self,  # type: ignore
            block_slot_or_hash: Union[SlotNumber, Hash32],
            max_headers: int = None,
            timeout: float = None) -> Tuple[BaseBeaconBlock, ...]:

        validator = BeaconBlocksValidator(block_slot_or_hash, max_headers)

        request = self.request_class(block_slot_or_hash, max_headers,
                                     gen_request_id())

        return await self.get_result(
            request,
            self._normalizer,
            validator,
            match_payload_request_id,
            timeout,
        )
Beispiel #2
0
def test_invalid_beacon_blocks_validation(block_slot_or_hash, max_blocks,
                                          result):
    validator = BeaconBlocksValidator(block_slot_or_hash, max_blocks)
    with pytest.raises(ValidationError):
        validator.validate_result(result)
Beispiel #3
0
def test_valid_beacon_blocks_validation(block_slot_or_hash, max_blocks,
                                        result):
    validator = BeaconBlocksValidator(10, 100)
    validator.validate_result(result)