Skip to content

Commit

Permalink
[FAB-17727] Log warning if system channel has no consortium members (#…
Browse files Browse the repository at this point in the history
…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 <enyeart@us.ibm.com>
(cherry picked from commit 4a2e781)
  • Loading branch information
denyeart committed Nov 20, 2020
1 parent 935a5c2 commit 0a1fc23
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion orderer/common/msgprocessor/systemchannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
Expand Down

0 comments on commit 0a1fc23

Please sign in to comment.