gpt4 book ai didi

go - 如何修复链码中的 "syntax error: unexpected shim, expecting comma or )"?

转载 作者:数据小太阳 更新时间:2023-10-29 03:36:05 24 4
gpt4 key购买 nike

我有链码,它应该加密数据并放入分类帐并进行查询。

我已经更新了 fabric 二进制文件,但在其他 fabric 样本链码中,这一行是相同的,没有任何错误。

func (s *SmartContract) queryPatient(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { 
if len(args) != 1 {
return shim.Error("Incorrect number of arguments. Expecting 1")
}

patientAsBytes, err := fc.Decrypter(APIstub, args[0])
if err != nil {
return shim.Error(err.Error())
}

return shim.Success(patientAsBytes)
}

错误是指向queryPatient(APIstub shim.ChaincodeStubInterface, args []string) sc.Response { .

最佳答案

不知道 sc.Response 中有什么,但在所有情况下您都返回 shim.Error() 类型。根据术语 stub ,我认为您使用的是 gRPC,它应该返回响应和错误。

关于go - 如何修复链码中的 "syntax error: unexpected shim, expecting comma or )"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57583638/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com