Skip to content

Commit 8369bd3

Browse files
committed
[FAB-3154] Fix the renaming of getChaincodeBytes
The existing getChaincodeBytes function actually create a deployment spec, rather than the name implies. This patchset unify those names of both chaincode spec creation and chaincode deployment spec creation. https://jira.hyperledger.org/browse/FAB-3154. Change-Id: I15d783abdb14feb7fb0ee89cadf6512374d07745 Signed-off-by: Baohua Yang <baohyang@cn.ibm.com>
1 parent e1dc407 commit 8369bd3

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

peer/chaincode/common.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ func checkSpec(spec *pb.ChaincodeSpec) error {
5151
return platform.ValidateSpec(spec)
5252
}
5353

54-
// getChaincodeBytes get chaincode deployment spec given the chaincode spec
55-
func getChaincodeBytes(spec *pb.ChaincodeSpec, crtPkg bool) (*pb.ChaincodeDeploymentSpec, error) {
54+
// getChaincodeDeploymentSpec get chaincode deployment spec given the chaincode spec
55+
func getChaincodeDeploymentSpec(spec *pb.ChaincodeSpec, crtPkg bool) (*pb.ChaincodeDeploymentSpec, error) {
5656
var codePackageBytes []byte
5757
if chaincode.IsDevMode() == false && crtPkg {
5858
var err error
@@ -70,7 +70,8 @@ func getChaincodeBytes(spec *pb.ChaincodeSpec, crtPkg bool) (*pb.ChaincodeDeploy
7070
return chaincodeDeploymentSpec, nil
7171
}
7272

73-
func getChaincodeSpecification(cmd *cobra.Command) (*pb.ChaincodeSpec, error) {
73+
// getChaincodeSpec get chaincode spec from the cli cmd pramameters
74+
func getChaincodeSpec(cmd *cobra.Command) (*pb.ChaincodeSpec, error) {
7475
spec := &pb.ChaincodeSpec{}
7576
if err := checkChaincodeCmdParams(cmd); err != nil {
7677
return spec, err
@@ -92,7 +93,7 @@ func getChaincodeSpecification(cmd *cobra.Command) (*pb.ChaincodeSpec, error) {
9293
}
9394

9495
func chaincodeInvokeOrQuery(cmd *cobra.Command, args []string, invoke bool, cf *ChaincodeCmdFactory) (err error) {
95-
spec, err := getChaincodeSpecification(cmd)
96+
spec, err := getChaincodeSpec(cmd)
9697
if err != nil {
9798
return err
9899
}

peer/chaincode/install.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ func generateChaincode(cmd *cobra.Command, chaincodeName, chaincodeVersion strin
9595
return nil, fmt.Errorf("chaincode %s:%s exists", chaincodeName, chaincodeVersion)
9696
}
9797

98-
spec, err := getChaincodeSpecification(cmd)
98+
spec, err := getChaincodeSpec(cmd)
9999
if err != nil {
100100
return nil, err
101101
}
102102

103-
cds, err := getChaincodeBytes(spec, true)
103+
cds, err := getChaincodeDeploymentSpec(spec, true)
104104
if err != nil {
105105
return nil, fmt.Errorf("Error getting chaincode code %s: %s", chainFuncName, err)
106106
}

peer/chaincode/instantiate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ func instantiateCmd(cf *ChaincodeCmdFactory) *cobra.Command {
4949

5050
//instantiate the command via Endorser
5151
func instantiate(cmd *cobra.Command, cf *ChaincodeCmdFactory) (*protcommon.Envelope, error) {
52-
spec, err := getChaincodeSpecification(cmd)
52+
spec, err := getChaincodeSpec(cmd)
5353
if err != nil {
5454
return nil, err
5555
}
5656

57-
cds, err := getChaincodeBytes(spec, false)
57+
cds, err := getChaincodeDeploymentSpec(spec, false)
5858
if err != nil {
5959
return nil, fmt.Errorf("Error getting chaincode code %s: %s", chainFuncName, err)
6060
}

peer/chaincode/package.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const package_desc = "Package the specified chaincode into a deployment spec."
4444
type ccDepSpecFactory func(spec *pb.ChaincodeSpec) (*pb.ChaincodeDeploymentSpec, error)
4545

4646
func defaultCDSFactory(spec *pb.ChaincodeSpec) (*pb.ChaincodeDeploymentSpec, error) {
47-
return getChaincodeBytes(spec, true)
47+
return getChaincodeDeploymentSpec(spec, true)
4848
}
4949

5050
// deployCmd returns the cobra command for Chaincode Deploy
@@ -153,7 +153,7 @@ func chaincodePackage(cmd *cobra.Command, args []string, cdsFact ccDepSpecFactor
153153
return err
154154
}
155155
}
156-
spec, err := getChaincodeSpecification(cmd)
156+
spec, err := getChaincodeSpec(cmd)
157157
if err != nil {
158158
return err
159159
}

peer/chaincode/upgrade.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ func upgradeCmd(cf *ChaincodeCmdFactory) *cobra.Command {
4747

4848
//upgrade the command via Endorser
4949
func upgrade(cmd *cobra.Command, cf *ChaincodeCmdFactory) (*protcommon.Envelope, error) {
50-
spec, err := getChaincodeSpecification(cmd)
50+
spec, err := getChaincodeSpec(cmd)
5151
if err != nil {
5252
return nil, err
5353
}
5454

55-
cds, err := getChaincodeBytes(spec, false)
55+
cds, err := getChaincodeDeploymentSpec(spec, false)
5656
if err != nil {
5757
return nil, fmt.Errorf("Error getting chaincode code %s: %s", chainFuncName, err)
5858
}

0 commit comments

Comments
 (0)