我正在更改超级账本结构的fabcar版本,并编写了一些功能。执行时,出现以下错误(下面提到的命令是shell脚本)
$ peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA -C $CHANNEL_NAME -n cloud $PEER_CONN_PARMS --isInit -c '{"function":"uploadData","Args":["DATA1","ID12345","/home/samplefile___pdf","3"]}'
Error: endorsement failure during invoke. response: status:500 message:"error in simulation: transaction returned with failure: Function uploadData not found in contract SmartContract"
下面是链码(摘要提及)
type SmartContract struct {
contractapi.Contract
}
type Data struct {
Owner string `json:"owner"`
File string `json:"file"`
FileChunkNumber string `json:"filechunknumber"`
SHA256 string `json:"sha256"`
}
// Uploads new data to the world state with given details
func (s *SmartContract) uploadData(ctx contractapi.TransactionContextInterface, args []string) error {
/*...*/
}
我不知道要更改的地方
我假设您在安装和实例化时更新了链码版本号或链码名称。 (1.4.6)
您是否尝试过链代码的现有功能,它们是否与您的invoke命令一起使用。如果没有,请遵循以下调用命令:
peer chaincode invoke -o orderer.example.com:7050 -C $CHANNEL_NAME -n cloud $PEER_CONN_PARMS -c '{"Args":["uploadData","DATA1","ID12345","/home/samplefile___pdf","3"]}'
我以前也遇到过类似的问题;可能有2个错误:
希望有帮助!