Skip to content

Commit

Permalink
[FAB-1711] Fix createConfigItem in blockutils
Browse files Browse the repository at this point in the history
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 <yacovm@il.ibm.com>
Change-Id: Ib9fecf7b32b92a1b030fe03c41c1d3aa29667424
  • Loading branch information
yacovm committed Jan 17, 2017
1 parent 47785fe commit aeb3f75
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions protos/utils/blockutils.go
Expand Up @@ -106,12 +106,12 @@ const (
func createConfigItem(chainID string,
configItemKey string,
configItemValue []byte,
modPolicy string) *cb.ConfigurationItem {
modPolicy string, configItemType cb.ConfigurationItem_ConfigurationType) *cb.ConfigurationItem {

ciChainHeader := MakeChainHeader(cb.HeaderType_CONFIGURATION_ITEM,
messageVersion, chainID, epoch)
configItem := MakeConfigurationItem(ciChainHeader,
cb.ConfigurationItem_Orderer, lastModified, modPolicy,
configItemType, lastModified, modPolicy,
configItemKey, configItemValue)

return configItem
Expand All @@ -120,8 +120,8 @@ func createConfigItem(chainID string,
func createSignedConfigItem(chainID string,
configItemKey string,
configItemValue []byte,
modPolicy string) *cb.SignedConfigurationItem {
configItem := createConfigItem(chainID, configItemKey, configItemValue, modPolicy)
modPolicy string, configItemType cb.ConfigurationItem_ConfigurationType) *cb.SignedConfigurationItem {
configItem := createConfigItem(chainID, configItemKey, configItemValue, modPolicy, configItemType)
return &cb.SignedConfigurationItem{
ConfigurationItem: MarshalOrPanic(configItem),
Signatures: nil}
Expand All @@ -146,10 +146,12 @@ func EncodeMSPUnsigned(testChainID string) *cb.ConfigurationItem {
if err != nil {
panic(fmt.Sprintf("GetLocalMspConfig failed, err %s", err))
}
// TODO: once https://gerrit.hyperledger.org/r/#/c/3941 is merged, change this to MSP
// Right now we don't have an MSP type there
return createConfigItem(testChainID,
mspKey,
MarshalOrPanic(conf),
XXX_DefaultModificationPolicyID)
XXX_DefaultModificationPolicyID, cb.ConfigurationItem_Orderer)
}

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

0 comments on commit aeb3f75

Please sign in to comment.