Commit 5d9a3eab authored by Gong Su's avatar Gong Su
Browse files

example04 uses hardcoded hashcode for example02



If chaincode_example02 directory has other files, its deployment hashcode will be
different from the hashcode ee5b... hardcoded in chaincode_example04.

Change-Id: I4d435123a58d07b3a434f32a3d08e9cf98fdb9c6
Signed-off-by: default avatarGong Su <gongsugongsu@gmail.com>
parent 551fa9b3
......@@ -882,11 +882,13 @@ func chaincodeInvokeChaincode(t *testing.T, user string) (err error) {
return
}
t.Logf("deployed chaincode_example04 got cID2:% s,\n chaincodeID2:% s", cID2, chaincodeID2)
time.Sleep(time.Second)
// Invoke second chaincode, which will inturn invoke the first chaincode
f = "invoke"
args = util.ToChaincodeArgs(f, "e", "1")
args = util.ToChaincodeArgs(f, "e", "1", chaincodeID1)
spec2 = &pb.ChaincodeSpec{Type: 1, ChaincodeID: cID2, CtorMsg: &pb.ChaincodeInput{Args: args}, SecureContext: user}
// Invoke chaincode
......
......@@ -70,8 +70,8 @@ func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface, function stri
var eventVal int // State of event
var err error
if len(args) != 2 {
return nil, errors.New("Incorrect number of arguments. Expecting 2")
if len(args) != 3 {
return nil, errors.New("Incorrect number of arguments. Expecting 3")
}
event = args[0]
......@@ -86,7 +86,7 @@ func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface, function stri
}
// Get the chaincode to call from the ledger
chainCodeToCall := t.GetChaincodeToCall()
chainCodeToCall := args[2] //t.GetChaincodeToCall()
f := "invoke"
invokeArgs := util.ToChaincodeArgs(f, "a", "b", "10")
......
......@@ -104,13 +104,13 @@ func TestExample04_Invoke(t *testing.T) {
checkInit(t, stub, []string{"Event", "1"})
// Invoke A->B for 10 via Example04's chaincode
checkInvoke(t, stub, []string{"Event", "1"})
checkInvoke(t, stub, []string{"Event", "1", scc.GetChaincodeToCall()})
checkQuery(t, stub, "Event", eventResponse)
checkQuery(t, stubEx2, "a", "101")
checkQuery(t, stubEx2, "b", "232")
// Invoke A->B for 10 via Example04's chaincode
checkInvoke(t, stub, []string{"Event", "1"})
checkInvoke(t, stub, []string{"Event", "1", scc.GetChaincodeToCall()})
checkQuery(t, stub, "Event", eventResponse)
checkQuery(t, stubEx2, "a", "91")
checkQuery(t, stubEx2, "b", "242")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment