def assert_events_get_response(self, msg): self.assertEqual(msg.message_type, validator_pb2.Message.CLIENT_EVENTS_GET_RESPONSE) events_response = client_event_pb2.ClientEventsGetResponse() events_response.ParseFromString(msg.content) self.assertEqual(events_response.status, client_event_pb2.ClientEventsGetResponse.OK) return events_response.events
async def _get_block_deltas(self, block_id): resp = await self._connection.send( Message.CLIENT_EVENTS_GET_REQUEST, client_event_pb2.ClientEventsGetRequest( subscriptions=self._make_subscriptions(), block_ids=[block_id]).SerializeToString(), timeout=DEFAULT_TIMEOUT) events_resp = client_event_pb2.ClientEventsGetResponse() events_resp.ParseFromString(resp.content) if events_resp.status == \ client_event_pb2.ClientEventsGetResponse.OK: events = list(events_resp.events) try: return StateDeltaEvent(events) except KeyError as err: LOGGER.warning("Received unexpected event list: %s", err) return None