func (s *DzblCC) queryMessage(stub shim.ChaincodeStubInterface, args []string) sc.Response {
if len(args) != 1 {
return shim.Error("Incorrect number of arguments. Expecting 1")
}
messageBytes, err := stub.GetState(args[0])
if err != nil {
return shim.Error(err.Error())
}
if messageBytes == nil {
return shim.Error("Entity not found")
}
return shim.Success(messageBytes)
}
func (s *DzblCC) addMessage(stub shim.ChaincodeStubInterface, args []string) sc.Response {
if len(args) != 2 {
return shim.Error("Incorrect number of arguments. Expecting 2")
}
err := stub.PutState(args[0], []byte(args[1]))
if err != nil {
return shim.Error(err.Error())
}
return shim.Success(nil)
}