Skip to content

Commit

Permalink
Use unique ID for queries and if no other specified
Browse files Browse the repository at this point in the history
Change-Id: Ib464c164661f76cb24e5d67cf9993a9b3df27912
Signed-off-by: Gabor Hosszu <gabor@digitalasset.com>
  • Loading branch information
gaborh-da committed Aug 10, 2016
1 parent eacd0e0 commit abb9076
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions core/devops.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,21 @@ func (d *Devops) invokeOrQuery(ctx context.Context, chaincodeInvocationSpec *pb.
var customIDgenAlg = strings.ToLower(chaincodeInvocationSpec.IdGenerationAlg)
var id string
var generr error
ctorbytes, merr := proto.Marshal(chaincodeInvocationSpec.ChaincodeSpec.CtorMsg)
if merr != nil {
return nil, fmt.Errorf("Error marshalling constructor: %s", merr)
}
id, generr = util.GenerateIDWithAlg(customIDgenAlg, ctorbytes)
if generr != nil {
return nil, generr
if invoke {
if customIDgenAlg != "" {
ctorbytes, merr := proto.Marshal(chaincodeInvocationSpec.ChaincodeSpec.CtorMsg)
if merr != nil {
return nil, fmt.Errorf("Error marshalling constructor: %s", merr)
}
id, generr = util.GenerateIDWithAlg(customIDgenAlg, ctorbytes)
if generr != nil {
return nil, generr
}
} else {
id = util.GenerateUUID()
}
} else {
id = util.GenerateUUID()
}
devopsLogger.Infof("Transaction ID: %v", id)
var transaction *pb.Transaction
Expand Down

0 comments on commit abb9076

Please sign in to comment.