diff --git a/common/configtx/tool/configtxgen/main.go b/common/configtx/tool/configtxgen/main.go index dd1e2491d5f..a1f329e1148 100644 --- a/common/configtx/tool/configtxgen/main.go +++ b/common/configtx/tool/configtxgen/main.go @@ -68,7 +68,11 @@ func doOutputChannelCreateTx(conf *genesisconfig.Profile, channelID string, outp } if conf.Application == nil { - return fmt.Errorf("Cannot define a new channel with no application section") + return fmt.Errorf("Cannot define a new channel with no Application section") + } + + if conf.Consortium == "" { + return fmt.Errorf("Cannot define a new channel with no Consortium section") } // XXX we ignore the non-application org names here, once the tool supports configuration updates diff --git a/common/configtx/tool/configtxgen/main_test.go b/common/configtx/tool/configtxgen/main_test.go index 1b04b1f719e..65fe75e8c14 100644 --- a/common/configtx/tool/configtxgen/main_test.go +++ b/common/configtx/tool/configtxgen/main_test.go @@ -62,6 +62,16 @@ func TestMissingOrdererSection(t *testing.T) { assert.Error(t, doOutputBlock(config, "foo", blockDest), "Missing orderer section") } +func TestMissingConsortiumSection(t *testing.T) { + configTxDest := tmpDir + string(os.PathSeparator) + "configtx" + + factory.InitFactories(nil) + config := genesisconfig.Load(genesisconfig.SampleSingleMSPChannelProfile) + config.Consortium = "" + + assert.Error(t, doOutputChannelCreateTx(config, "foo", configTxDest), "Missing Consortium section in Application Profile definition") +} + func TestInspectConfigTx(t *testing.T) { configTxDest := tmpDir + string(os.PathSeparator) + "configtx"