diff --git a/common/config/channel.go b/common/config/channel.go index 8a40a35aa83..2ac1083ae54 100644 --- a/common/config/channel.go +++ b/common/config/channel.go @@ -28,6 +28,9 @@ import ( // Channel config keys const ( + // ConsortiumKey is the key for the cb.ConfigValue for the Consortium message + ConsortiumKey = "Consortium" + // HashingAlgorithmKey is the cb.ConfigItem type key name for the HashingAlgorithm message HashingAlgorithmKey = "HashingAlgorithm" @@ -60,6 +63,7 @@ type ChannelProtos struct { HashingAlgorithm *cb.HashingAlgorithm BlockDataHashingStructure *cb.BlockDataHashingStructure OrdererAddresses *cb.OrdererAddresses + Consortium *cb.Consortium } type channelConfigSetter struct { @@ -165,6 +169,11 @@ func (cc *ChannelConfig) OrdererAddresses() []string { return cc.protos.OrdererAddresses.Addresses } +// ConsortiumName returns the name of the consortium this channel was created under +func (cc *ChannelConfig) ConsortiumName() string { + return cc.protos.Consortium.Name +} + // Validate inspects the generated configuration protos, ensures that the values are correct, and // sets the ChannelConfig fields that may be referenced after Commit func (cc *ChannelConfig) Validate(tx interface{}, groups map[string]ValueProposer) error { diff --git a/common/config/channel_util.go b/common/config/channel_util.go index 44a028f27ec..10ea58f67e5 100644 --- a/common/config/channel_util.go +++ b/common/config/channel_util.go @@ -34,10 +34,14 @@ func configGroup(key string, value []byte) *cb.ConfigGroup { return result } +// TemplateConsortiumName creates a ConfigGroup representing the ConsortiumName +func TemplateConsortium(name string) *cb.ConfigGroup { + return configGroup(ConsortiumKey, utils.MarshalOrPanic(&cb.Consortium{Name: name})) +} + // TemplateHashingAlgorithm creates a ConfigGroup representing the HashingAlgorithm func TemplateHashingAlgorithm(name string) *cb.ConfigGroup { return configGroup(HashingAlgorithmKey, utils.MarshalOrPanic(&cb.HashingAlgorithm{Name: name})) - } // DefaultHashingAlgorithm creates a headerless config item for the default hashing algorithm diff --git a/protos/common/common.pb.go b/protos/common/common.pb.go index 30b22e70d09..25bcaf80198 100644 --- a/protos/common/common.pb.go +++ b/protos/common/common.pb.go @@ -39,6 +39,7 @@ It has these top-level messages: HashingAlgorithm BlockDataHashingStructure OrdererAddresses + Consortium BlockchainInfo Policy SignaturePolicyEnvelope diff --git a/protos/common/configuration.pb.go b/protos/common/configuration.pb.go index a4d1cb8e438..3694b28702e 100644 --- a/protos/common/configuration.pb.go +++ b/protos/common/configuration.pb.go @@ -49,28 +49,40 @@ func (m *OrdererAddresses) String() string { return proto.CompactText func (*OrdererAddresses) ProtoMessage() {} func (*OrdererAddresses) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} } +// Consortium represents the consortium context in which the channel was created +type Consortium struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` +} + +func (m *Consortium) Reset() { *m = Consortium{} } +func (m *Consortium) String() string { return proto.CompactTextString(m) } +func (*Consortium) ProtoMessage() {} +func (*Consortium) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{3} } + func init() { proto.RegisterType((*HashingAlgorithm)(nil), "common.HashingAlgorithm") proto.RegisterType((*BlockDataHashingStructure)(nil), "common.BlockDataHashingStructure") proto.RegisterType((*OrdererAddresses)(nil), "common.OrdererAddresses") + proto.RegisterType((*Consortium)(nil), "common.Consortium") } func init() { proto.RegisterFile("common/configuration.proto", fileDescriptor2) } var fileDescriptor2 = []byte{ - // 218 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x4c, 0x8e, 0x41, 0x4b, 0x03, 0x31, - 0x10, 0x85, 0x59, 0xd4, 0xc2, 0x0e, 0x08, 0x25, 0x78, 0xa8, 0xe2, 0xa1, 0x2c, 0x22, 0x05, 0x61, - 0xa3, 0xf8, 0x0b, 0x5a, 0x3c, 0x78, 0x13, 0xb6, 0x37, 0x6f, 0xd9, 0x64, 0x9a, 0x04, 0x77, 0x33, - 0x65, 0x32, 0x8b, 0xf8, 0xef, 0xc5, 0x8d, 0x62, 0x6f, 0xf3, 0xcd, 0xfb, 0x1e, 0x3c, 0xb8, 0xb1, - 0x34, 0x8e, 0x94, 0xb4, 0xa5, 0x74, 0x88, 0x7e, 0x62, 0x23, 0x91, 0x52, 0x7b, 0x64, 0x12, 0x52, - 0x8b, 0x92, 0x35, 0xf7, 0xb0, 0x7c, 0x35, 0x39, 0xc4, 0xe4, 0xb7, 0x83, 0x27, 0x8e, 0x12, 0x46, - 0xa5, 0xe0, 0x3c, 0x99, 0x11, 0x57, 0xd5, 0xba, 0xda, 0xd4, 0xdd, 0x7c, 0x37, 0x4f, 0x70, 0xbd, - 0x1b, 0xc8, 0x7e, 0xbc, 0x18, 0x31, 0xbf, 0x85, 0xbd, 0xf0, 0x64, 0x65, 0x62, 0x54, 0x57, 0x70, - 0xf1, 0x19, 0x9d, 0x84, 0xb9, 0x71, 0xd9, 0x15, 0x68, 0x1e, 0x61, 0xf9, 0xc6, 0x0e, 0x19, 0x79, - 0xeb, 0x1c, 0x63, 0xce, 0x98, 0xd5, 0x2d, 0xd4, 0xe6, 0x0f, 0x56, 0xd5, 0xfa, 0x6c, 0x53, 0x77, - 0xff, 0x8f, 0xdd, 0x1e, 0xee, 0x88, 0x7d, 0x1b, 0xbe, 0x8e, 0xc8, 0x03, 0x3a, 0x8f, 0xdc, 0x1e, - 0x4c, 0xcf, 0xd1, 0x96, 0xd1, 0xb9, 0x2d, 0xa3, 0xdf, 0x1f, 0x7c, 0x94, 0x30, 0xf5, 0x3f, 0xa8, - 0x4f, 0x64, 0x5d, 0x64, 0x5d, 0x64, 0x5d, 0xe4, 0x7e, 0x31, 0xe3, 0xf3, 0x77, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xf0, 0x7e, 0xef, 0xa1, 0x0e, 0x01, 0x00, 0x00, + // 230 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x8f, 0xc1, 0x4a, 0x03, 0x31, + 0x10, 0x86, 0x59, 0xd4, 0xc2, 0x0e, 0x08, 0x25, 0x78, 0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x22, + 0xcb, 0x22, 0xcb, 0x22, 0x0f, 0x8b, 0x19, 0x1f, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xb6, 0x15, + 0xb9, 0xb4, 0x30, 0x01, 0x00, 0x00, } diff --git a/protos/common/configuration.proto b/protos/common/configuration.proto index 614d7cd9dd9..b5dff19629f 100644 --- a/protos/common/configuration.proto +++ b/protos/common/configuration.proto @@ -41,3 +41,8 @@ message BlockDataHashingStructure { message OrdererAddresses { repeated string addresses = 1; } + +// Consortium represents the consortium context in which the channel was created +message Consortium { + string name = 1; +}