def handle(self, connection_id, message_content): # If this is the configured consensus engine, make it active. This is # necessary for setting the active engine on genesis and when the # configured engine is changed to an engine that is not registered yet request = consensus_pb2.ConsensusRegisterRequest() try: request.ParseFromString(message_content) except DecodeError: LOGGER.exception("Unable to decode ConsensusRegisterRequest") return HandlerResult(status=HandlerResult.DROP) self._proxy.activate_if_configured(request.name, request.version) return HandlerResult(status=HandlerStatus.PASS)
def handle(self, connection_id, message_content): # If this is the configured consensus engine, make it active. This is # necessary for setting the active engine when the configured engine is # changed to an engine that is not registered yet request = consensus_pb2.ConsensusRegisterRequest() try: request.ParseFromString(message_content) except DecodeError: LOGGER.exception("Unable to decode ConsensusRegisterRequest") return HandlerResult(status=HandlerResult.DROP) if request.additional_protocols is not None: additional_protocols = \ [(p.name, p.version) for p in request.additional_protocols] else: additional_protocols = [] self._proxy.activate_if_configured( request.name, request.version, additional_protocols) return HandlerResult(status=HandlerStatus.PASS)