def handle(self, connection_id, message_content):
response_proto = client_batch_submit_pb2.ClientBatchSubmitResponse
def make_response(out_status):
return HandlerResult(
status=HandlerStatus.RETURN,
message_out=response_proto(status=out_status),
message_type=Message.CLIENT_BATCH_SUBMIT_RESPONSE)
try:
request = client_batch_submit_pb2.ClientBatchSubmitRequest()
request.ParseFromString(message_content)
for batch in request.batches:
if batch.trace:
LOGGER.debug("TRACE %s: %s", batch.header_signature,
self.__class__.__name__)
if not all(
self._verifier.check_off_chain_batch_roles(batch)
for batch in request.batches):
return make_response(response_proto.INVALID_BATCH)
if not all(
self._verifier.is_batch_signer_authorized(batch)
for batch in request.batches):
return make_response(response_proto.INVALID_BATCH)
except DecodeError:
return make_response(response_proto.INTERNAL_ERROR)
return HandlerResult(status=HandlerStatus.PASS)
评论列表
文章目录