-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to introduce new methods? #37
Comments
in iotcontractminimalsample/main.go, when I import my own "iotcontractplatform" package (i.e. from my own repo) I get the following error when I try deploying chaincode: Error when deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' failed with error: "exit status 2"\n# github.com/mna2016/lssblockchain2/contracts/platform/iotcontractminimalsample\n/opt/gopath/usercode/452077432/src/github.com/mna2016/lssblockchain2/contracts/platform/iotcontractminimalsample/main.go:41: cannot use log (type *"github.com/mna2016/lssblockchain2/contracts/platform/iotcontractminimalsample/vendor/github.com/hyperledger/fabric/core/chaincode/shim".ChaincodeLogger) as type *"github.com/hyperledger/fabric/core/chaincode/shim".ChaincodeLogger in argument to "github.com/mna2016/lssblockchain2/contracts/platform/iotcontractplatform" |
You changed the content of a contract platform file, which is not appropriate. The iotcontractcontainersample is the appropriate sample to follow for a custom contract. What probably happened is that you did not re-vendor your contract and thus your changes were not picked up correctly. I suggest that you derive from the container sample and add your work in assetContainer.go. Or create your own new contract for your use case and rename a fresh copy of the container sample to match. Vendoring is critical for deploying to v0.6 fabrics. I have not had time to port the platform to v1 fabrics and so you would have to use the one under the v1 folders and solve all the issues I never got to. Needless to say, you might be better off moving to the Hyperledger Composer for now. The error is almost certainly a vendoring issue. |
I have to add 2 methods. One is a query method and second is a invoke method. I have created the function bodies and declared the functions inside ctasset.go. I also added "AddRoute" calls for the 2 new methods.
Now when I am testing these functions, the calls are not routed to them. Am I missing something?
The readme perhaps does not show how to add new "query" and/or "invoke" methods to extend the contract(Please correct me If I am not). Any link\document will be of great help.
The text was updated successfully, but these errors were encountered: