permission_verifier.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:sawtooth-core 作者: hyperledger 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号