diff --git a/trinity/plugins/builtin/ethstats/ethstats_client.py b/trinity/plugins/builtin/ethstats/ethstats_client.py index b465b8cc8d..daa64e3b0c 100644 --- a/trinity/plugins/builtin/ethstats/ethstats_client.py +++ b/trinity/plugins/builtin/ethstats/ethstats_client.py @@ -59,7 +59,7 @@ async def recv_handler(self) -> None: try: message: EthstatsMessage = self.deserialize_message(json_string) except EthstatsException as e: - self.logger.info('Cannot parse message from server: %s' % e) + self.logger.warning('Cannot parse message from server: %s' % e) return await self.recv_queue.put(message) @@ -84,6 +84,9 @@ def deserialize_message(self, json_string: str) -> EthstatsMessage: except json.decoder.JSONDecodeError as e: raise EthstatsException('Received incorrect JSON: %s' % e) + if isinstance(raw_message, str): + raise EthstatsException(f'Received invalid payload: {raw_message}') + try: payload = raw_message['emit'] except KeyError: