예제 #1
0
        /**
         *
         * @return Chaincode response packed as payload inside COMPLETE message packed as payload inside RESPONSE message
         */

        public List <ChaincodeMessage> Next()
        {
            ByteString chaincodeResponse = new Protos.Peer.ProposalResponsePackage.Response {
                Status = (int)Protos.Common.Status.Success, Message = "OK"
            }.ToByteString();
            ByteString completePayload = new ChaincodeMessage {
                Type = ChaincodeMessage.Types.Type.Completed, ChannelId = orgMsg.ChannelId, Txid = orgMsg.Txid, Payload = chaincodeResponse
            }.ToByteString();
            List <ChaincodeMessage> list = new List <ChaincodeMessage>();

            list.Add(new ChaincodeMessage {
                Type = ChaincodeMessage.Types.Type.Response, ChannelId = orgMsg.ChannelId, Txid = orgMsg.Txid, Payload = completePayload
            });
            return(list);
        }
예제 #2
0
 private static Protos.Peer.ProposalResponsePackage.Response ToProtoResponse(Response response)
 {
     Protos.Peer.ProposalResponsePackage.Response resp = new Protos.Peer.ProposalResponsePackage.Response()
     {
         Status = (int)response.Status
     };
     if (response.Message != null)
     {
         resp.Message = response.Message;
     }
     if (response.Payload != null)
     {
         resp.Payload = ByteString.CopyFrom(response.Payload);
     }
     return(resp);
 }
예제 #3
0
 private static Response ToChaincodeResponse(Protos.Peer.ProposalResponsePackage.Response response)
 {
     return(new Response((Status)response.Status, response.Message, response.Payload.ToByteArray()));
 }