Skip to content

Commit

Permalink
Amend mockstub.InvokeChaincode comments
Browse files Browse the repository at this point in the history
Change-Id: Idf05c9ada738e42cb2912e9eae4b04bdf91e221a
Signed-off-by: jiangyaoguo <jiangyaoguo@gmail.com>
  • Loading branch information
jiangyaoguo committed Aug 22, 2016
1 parent 8ea25a9 commit a15d984
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/chaincode/shim/mockstub.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ func (stub *MockStub) DeleteRow(tableName string, key []Column) error {
}

// Invokes a peered chaincode.
// E.g. stub1.InvokeChaincode("stub2Hash", func, args)
// E.g. stub1.InvokeChaincode("stub2Hash", funcArgs)
// Before calling this make sure to create another MockStub stub2, call stub2.MockInit(uuid, func, args)
// and register it with stub1 by calling stub1.MockPeerChaincode(
// and register it with stub1 by calling stub1.MockPeerChaincode("stub2Hash", stub2)
func (stub *MockStub) InvokeChaincode(chaincodeName string, args [][]byte) ([]byte, error) {
// TODO "args" here should possibly be a serialized pb.ChaincodeInput
function, params := getFuncArgs(args)
Expand All @@ -249,10 +249,10 @@ func (stub *MockStub) QueryChaincode(chaincodeName string, args [][]byte) ([]byt
mockLogger.Error("Could not find peer chaincode to query", chaincodeName)
return nil, errors.New("Could not find peer chaincode to query")
}
mockLogger.Debug("MockStub", stub.Name, "Invoking peer chaincode", otherStub.Name, args)
mockLogger.Debug("MockStub", stub.Name, "Querying peer chaincode", otherStub.Name, args)
function, params := getFuncArgs(args)
bytes, err := otherStub.MockQuery(function, params)
mockLogger.Debug("MockStub", stub.Name, "Invoked peer chaincode", otherStub.Name, "got", bytes, err)
mockLogger.Debug("MockStub", stub.Name, "Queried peer chaincode", otherStub.Name, "got", bytes, err)
return bytes, err
}

Expand Down

0 comments on commit a15d984

Please sign in to comment.