我可以通过以下命令从对等方调用链代码:
peer chaincode invoke -o coreOrderer.dip.com:7050 --tls --cafile /etc/hyperledger/tlsca.dip.com-cert.pem --tlsRootCertFiles /etc/hyperledger/fabric/tls/ca.crt -C dipchannel -n mycc --peerAddresses peer0.core.dip.com:7051 -c '{"Args":["query","a"]}'
它有效,我可以在对等日志中看到:
Entry chaincode: name:"mycc"
Exit chaincode: name:"mycc" (2ms)
我可以在我的链码容器中看到这个调用的结果。
但是当我试图通过 SDK 从我的代码中调用时
req := channel.Request{
ChaincodeID: "mycc",
Fcn: "query",
Args: [][]byte{[]byte("a")},
}
resp, err := client.Execute(req)
我有空响应,在对等日志中我看到:
Entry chaincode: name:"cscc"
Exit chaincode: name:"cscc" (1ms)
Entry chaincode: name:"lscc"
Exit chaincode: name:"lscc" (1ms)
为什么它调用“cscc”和“lscc”链码而不调用“mycc”?