Skip to content

Commit aeb3f75

Browse files
committed
[FAB-1711] Fix createConfigItem in blockutils
protos/utils/blockutils.go createConfigItem in blockutils over-writes item type with ConfigurationItem_Orderer. This commit fixes this, but I can't fix the MSP config creation because the MSP type is not introduced yet. Therefore, I added a TODO and will revisit once the MSP type is introduced in https://gerrit.hyperledger.org/r/#/c/3941 Signed-off-by: Yacov Manevich <[email protected]> Change-Id: Ib9fecf7b32b92a1b030fe03c41c1d3aa29667424
1 parent 47785fe commit aeb3f75

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

protos/utils/blockutils.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ const (
106106
func createConfigItem(chainID string,
107107
configItemKey string,
108108
configItemValue []byte,
109-
modPolicy string) *cb.ConfigurationItem {
109+
modPolicy string, configItemType cb.ConfigurationItem_ConfigurationType) *cb.ConfigurationItem {
110110

111111
ciChainHeader := MakeChainHeader(cb.HeaderType_CONFIGURATION_ITEM,
112112
messageVersion, chainID, epoch)
113113
configItem := MakeConfigurationItem(ciChainHeader,
114-
cb.ConfigurationItem_Orderer, lastModified, modPolicy,
114+
configItemType, lastModified, modPolicy,
115115
configItemKey, configItemValue)
116116

117117
return configItem
@@ -120,8 +120,8 @@ func createConfigItem(chainID string,
120120
func createSignedConfigItem(chainID string,
121121
configItemKey string,
122122
configItemValue []byte,
123-
modPolicy string) *cb.SignedConfigurationItem {
124-
configItem := createConfigItem(chainID, configItemKey, configItemValue, modPolicy)
123+
modPolicy string, configItemType cb.ConfigurationItem_ConfigurationType) *cb.SignedConfigurationItem {
124+
configItem := createConfigItem(chainID, configItemKey, configItemValue, modPolicy, configItemType)
125125
return &cb.SignedConfigurationItem{
126126
ConfigurationItem: MarshalOrPanic(configItem),
127127
Signatures: nil}
@@ -146,10 +146,12 @@ func EncodeMSPUnsigned(testChainID string) *cb.ConfigurationItem {
146146
if err != nil {
147147
panic(fmt.Sprintf("GetLocalMspConfig failed, err %s", err))
148148
}
149+
// TODO: once https://gerrit.hyperledger.org/r/#/c/3941 is merged, change this to MSP
150+
// Right now we don't have an MSP type there
149151
return createConfigItem(testChainID,
150152
mspKey,
151153
MarshalOrPanic(conf),
152-
XXX_DefaultModificationPolicyID)
154+
XXX_DefaultModificationPolicyID, cb.ConfigurationItem_Orderer)
153155
}
154156

155157
// EncodeMSP gets the signed configuration item with the default MSP
@@ -159,8 +161,10 @@ func EncodeMSP(testChainID string) *cb.SignedConfigurationItem {
159161
if err != nil {
160162
panic(fmt.Sprintf("GetLocalMspConfig failed, err %s", err))
161163
}
164+
// TODO: once https://gerrit.hyperledger.org/r/#/c/3941 is merged, change this to MSP
165+
// Right now we don't have an MSP type there
162166
return createSignedConfigItem(testChainID,
163167
mspKey,
164168
MarshalOrPanic(conf),
165-
XXX_DefaultModificationPolicyID)
169+
XXX_DefaultModificationPolicyID, cb.ConfigurationItem_Orderer)
166170
}

0 commit comments

Comments
 (0)