From aeb3f758109952790ea67ea44062b82943d56cc2 Mon Sep 17 00:00:00 2001 From: YACOVM Date: Tue, 17 Jan 2017 23:47:33 +0200 Subject: [PATCH] [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 Change-Id: Ib9fecf7b32b92a1b030fe03c41c1d3aa29667424 --- protos/utils/blockutils.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/protos/utils/blockutils.go b/protos/utils/blockutils.go index 671dca78c3c..b3bc0e36d0c 100644 --- a/protos/utils/blockutils.go +++ b/protos/utils/blockutils.go @@ -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 @@ -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} @@ -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 @@ -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) }