MCPcopy
hub / github.com/hyperledger/fabric / put

Method put

integration/chaincode/multi/chaincode.go:68–79  ·  view source on GitHub ↗

put to state keys from "key0" to "key(cntCall-1)"

(stub shim.ChaincodeStubInterface, numberCallsPut string)

Source from the content-addressed store, hash-verified

66
67// put to state keys from "key0" to "key(cntCall-1)"
68func (t *Operations) put(stub shim.ChaincodeStubInterface, numberCallsPut string) *pb.Response {
69 cntCall, _ := strconv.Atoi(numberCallsPut)
70
71 for i := range cntCall {
72 key := "key" + strconv.Itoa(i)
73 err := stub.PutState(key, []byte(key))
74 if err != nil {
75 return shim.Error(err.Error())
76 }
77 }
78 return shim.Success(nil)
79}
80
81func (t *Operations) getKey(stub shim.ChaincodeStubInterface, keyUniq string) *pb.Response {
82 key := "key" + keyUniq

Callers 1

InvokeMethod · 0.95

Calls 2

PutStateMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected