// Validate inspects the generated configuration protos, ensures that the values are correct, and
// sets the ChannelConfig fields that may be referenced after Commit
Validate inspects the generated configuration protos, ensures that the values are correct, and
sets the ChannelConfig fields that may be referenced after Commit
// 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 {
	for _, validator := range []func() error{
		cc.validateHashingAlgorithm,
		cc.validateBlockDataHashingStructure,
		cc.validateOrdererAddresses,
	} {
		if err := validator(); err != nil {
			return err
		}
	}
	var ok bool
	for key, value := range groups {
		switch key {
		case ApplicationGroupKey:
			cc.appConfig, ok = value.(*ApplicationGroup)
			if !ok {
				return fmt.Errorf("Application group was not Application config")
			}
		case OrdererGroupKey:
			cc.ordererConfig, ok = value.(*OrdererGroup)
			if !ok {
				return fmt.Errorf("Orderer group was not Orderer config")
			}
		case ConsortiumsGroupKey:
			cc.consortiumsConfig, ok = value.(*ConsortiumsGroup)
			if !ok {
				return fmt.Errorf("Consortiums group was no Consortium config")
			}
		default:
			return fmt.Errorf("Disallowed channel group: %s", key)
		}
	}
	return nil
}
func ( cc * ChannelConfig ) Validate ( tx interface { } , groups map [ string ] ValueProposer ) error { for _ , validator := range [ ] func ( ) error { cc . validateHashingAlgorithm , cc . validateBlockDataHashingStructure , cc . validateOrdererAddresses , } { if err := validator ( ) ; err != nil { return err } } var ok bool for key , value := range groups { switch key { case ApplicationGroupKey : cc . appConfig , ok = value . ( * ApplicationGroup ) if ! ok { return fmt . Errorf ( " " ) } case OrdererGroupKey : cc . ordererConfig , ok = value . ( * OrdererGroup ) if ! ok { return fmt . Errorf ( " " ) } case ConsortiumsGroupKey : cc . consortiumsConfig , ok = value . ( * ConsortiumsGroup ) if ! ok { return fmt . Errorf ( " " ) } default : return fmt . Errorf ( " " , key ) } } return nil }
Validate inspects the generated configuration protos, ensures that the values are correct, and
sets the ChannelConfig fields that may be referenced after Commit
Validate inspects the generated configuration protos ensures that the values are correct and sets the ChannelConfig fields that may be referenced after Commit