Skip to content

Commit 3d169cc

Browse files
author
Srinivasan Muralidharan
committed
[FAB-3645] adding cc bytes instead of its hash
Bug in computing the hash caused ChaincodeDeploymentSpec.CodePackage to be set instead of its hash causing payload bloat. Change-Id: I83dbea5667b1709e9e22951b19585302b3168033 Signed-off-by: Srinivasan Muralidharan <[email protected]>
1 parent 1d31ce3 commit 3d169cc

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

core/common/ccprovider/cdspackage.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ func (ccpack *CDSPackage) getCDSData(cds *pb.ChaincodeDeploymentSpec) ([]byte, [
146146
cdsdata := &CDSData{}
147147

148148
//code hash
149-
cdsdata.CodeHash = hash.Sum(cds.CodePackage)
149+
hash.Write(cds.CodePackage)
150+
cdsdata.CodeHash = hash.Sum(nil)
150151

151152
hash.Reset()
152153

core/common/ccprovider/sigcdspackage.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ func (ccpack *SignedCDSPackage) getCDSData(scds *pb.SignedChaincodeDeploymentSpe
160160
scdsdata := &SignedCDSData{}
161161

162162
//get the code hash
163-
scdsdata.CodeHash = hash.Sum(cds.CodePackage)
163+
hash.Write(cds.CodePackage)
164+
scdsdata.CodeHash = hash.Sum(nil)
164165

165166
hash.Reset()
166167

0 commit comments

Comments
 (0)