Skip to content

Commit 180bd72

Browse files
committed
check transaction amount
expecting a integer for a transaction amount Change-Id: I71fec55f277709d4382199143adf29a3a98210fa Signed-off-by: xiejunan <[email protected]>
1 parent dc2d339 commit 180bd72

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

examples/chaincode/go/chaincode_example02/chaincode_example02.go

+3
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface, function stri
111111

112112
// Perform the execution
113113
X, err = strconv.Atoi(args[2])
114+
if err != nil {
115+
return nil, errors.New("Invalid transaction amount, expecting a integer value")
116+
}
114117
Aval = Aval - X
115118
Bval = Bval + X
116119
fmt.Printf("Aval = %d, Bval = %d\n", Aval, Bval)

examples/chaincode/go/chaincode_example04/chaincode_example04.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type SimpleChaincode struct {
3434
func (t *SimpleChaincode) GetChaincodeToCall() string {
3535
//This is the hashcode for github.com/hyperledger/fabric/core/example/chaincode/chaincode_example02
3636
//if the example is modifed this hashcode will change!!
37-
chainCodeToCall := "980d4bb7f69578592e5775a6da86d81a221887817d7164d3e9d4d4df1c981440abf9a61417eaf8ad6f7fc79893da36de2cf4709131e9af39bca6ebc2e5a1cd9d"
37+
chainCodeToCall := "ee5b24a1f17c356dd5f6e37307922e39ddba12e5d2e203ed93401d7d05eb0dd194fb9070549c5dc31eb63f4e654dbd5a1d86cbb30c48e3ab1812590cd0f78539"
3838
return chainCodeToCall
3939
}
4040

0 commit comments

Comments
 (0)