From 0a1fc23c40cc91dc59fdd0c5e509a3c230c5cc60 Mon Sep 17 00:00:00 2001 From: denyeart Date: Thu, 19 Nov 2020 21:48:49 -0500 Subject: [PATCH] [FAB-17727] Log warning if system channel has no consortium members (#2149) When generating create channel transaction, if system channel has no consortium members, log a Warning since this may be an unexpected situation for the user. Additionally, if the application channel has members, the create channel transaction will eventually get invalidated. Signed-off-by: David Enyeart (cherry picked from commit 4a2e7818a58766a248c907512aab08e3a4fd08fe) --- orderer/common/msgprocessor/systemchannel.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/orderer/common/msgprocessor/systemchannel.go b/orderer/common/msgprocessor/systemchannel.go index 4150db95342..6cd618f30c6 100644 --- a/orderer/common/msgprocessor/systemchannel.go +++ b/orderer/common/msgprocessor/systemchannel.go @@ -327,7 +327,7 @@ func (dt *DefaultTemplator) NewChannelConfig(envConfigUpdate *cb.Envelope) (chan return nil, fmt.Errorf("Proposed configuration has no application group members, but consortium contains members") } - // If the consortium has no members, allow the source request to contain arbitrary members + // If the consortium has no members, allow the source request to contain arbitrary members, even though the eventual channel creation transaction may get invalidated // Otherwise, require that the supplied members are a subset of the consortium members if len(systemChannelGroup.Groups[channelconfig.ConsortiumsGroupKey].Groups[consortium.Name].Groups) > 0 { for orgName := range configUpdate.WriteSet.Groups[channelconfig.ApplicationGroupKey].Groups { @@ -337,6 +337,12 @@ func (dt *DefaultTemplator) NewChannelConfig(envConfigUpdate *cb.Envelope) (chan } applicationGroup.Groups[orgName] = proto.Clone(consortiumGroup).(*cb.ConfigGroup) } + } else { + // If consortium has no members, log a Warning to help troulbeshoot any issues, + // e.g. if channel creation transaction eventually gets invalidated due to including members + logger.Warnf("System channel consortium has no members, attempting to create application channel %s with %d members", + channelHeader.ChannelId, + len(configUpdate.WriteSet.Groups[channelconfig.ApplicationGroupKey].Groups)) } channelGroup := protoutil.NewConfigGroup()