@@ -50,7 +50,7 @@ var handler *Handler
50
50
// ChaincodeStub is an object passed to chaincode for shim side handling of
51
51
// APIs.
52
52
type ChaincodeStub struct {
53
- UUID string
53
+ TxID string
54
54
securityContext * pb.ChaincodeSecurityContext
55
55
chaincodeEvent * pb.ChaincodeEvent
56
56
args [][]byte
@@ -234,8 +234,8 @@ func chatWithPeer(chaincodename string, stream PeerChaincodeStream, cc Chaincode
234
234
// -- init stub ---
235
235
// ChaincodeInvocation functionality
236
236
237
- func (stub * ChaincodeStub ) init (uuid string , secContext * pb.ChaincodeSecurityContext ) {
238
- stub .UUID = uuid
237
+ func (stub * ChaincodeStub ) init (txid string , secContext * pb.ChaincodeSecurityContext ) {
238
+ stub .TxID = txid
239
239
stub .securityContext = secContext
240
240
stub .args = [][]byte {}
241
241
newCI := pb.ChaincodeInput {}
@@ -247,6 +247,10 @@ func (stub *ChaincodeStub) init(uuid string, secContext *pb.ChaincodeSecurityCon
247
247
}
248
248
}
249
249
250
+ func (stub * ChaincodeStub ) GetTxID () string {
251
+ return stub .TxID
252
+ }
253
+
250
254
// --------- Security functions ----------
251
255
//CHAINCODE SEC INTERFACE FUNCS TOBE IMPLEMENTED BY ANGELO
252
256
@@ -256,31 +260,31 @@ func (stub *ChaincodeStub) init(uuid string, secContext *pb.ChaincodeSecurityCon
256
260
// same transaction context; that is, chaincode calling chaincode doesn't
257
261
// create a new transaction message.
258
262
func (stub * ChaincodeStub ) InvokeChaincode (chaincodeName string , args [][]byte ) ([]byte , error ) {
259
- return handler .handleInvokeChaincode (chaincodeName , args , stub .UUID )
263
+ return handler .handleInvokeChaincode (chaincodeName , args , stub .TxID )
260
264
}
261
265
262
266
// QueryChaincode locally calls the specified chaincode `Query` using the
263
267
// same transaction context; that is, chaincode calling chaincode doesn't
264
268
// create a new transaction message.
265
269
func (stub * ChaincodeStub ) QueryChaincode (chaincodeName string , args [][]byte ) ([]byte , error ) {
266
- return handler .handleQueryChaincode (chaincodeName , args , stub .UUID )
270
+ return handler .handleQueryChaincode (chaincodeName , args , stub .TxID )
267
271
}
268
272
269
273
// --------- State functions ----------
270
274
271
275
// GetState returns the byte array value specified by the `key`.
272
276
func (stub * ChaincodeStub ) GetState (key string ) ([]byte , error ) {
273
- return handler .handleGetState (key , stub .UUID )
277
+ return handler .handleGetState (key , stub .TxID )
274
278
}
275
279
276
280
// PutState writes the specified `value` and `key` into the ledger.
277
281
func (stub * ChaincodeStub ) PutState (key string , value []byte ) error {
278
- return handler .handlePutState (key , value , stub .UUID )
282
+ return handler .handlePutState (key , value , stub .TxID )
279
283
}
280
284
281
285
// DelState removes the specified `key` and its value from the ledger.
282
286
func (stub * ChaincodeStub ) DelState (key string ) error {
283
- return handler .handleDelState (key , stub .UUID )
287
+ return handler .handleDelState (key , stub .TxID )
284
288
}
285
289
286
290
//ReadCertAttribute is used to read an specific attribute from the transaction certificate, *attributeName* is passed as input parameter to this function.
@@ -331,11 +335,11 @@ type StateRangeQueryIterator struct {
331
335
// between the startKey and endKey, inclusive. The order in which keys are
332
336
// returned by the iterator is random.
333
337
func (stub * ChaincodeStub ) RangeQueryState (startKey , endKey string ) (StateRangeQueryIteratorInterface , error ) {
334
- response , err := handler .handleRangeQueryState (startKey , endKey , stub .UUID )
338
+ response , err := handler .handleRangeQueryState (startKey , endKey , stub .TxID )
335
339
if err != nil {
336
340
return nil , err
337
341
}
338
- return & StateRangeQueryIterator {handler , stub .UUID , response , 0 }, nil
342
+ return & StateRangeQueryIterator {handler , stub .TxID , response , 0 }, nil
339
343
}
340
344
341
345
// HasNext returns true if the range query iterator contains additional keys
0 commit comments