Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit b5424d1

Browse files
Copying Policy and ModPolicy when fetching config from orderer. (#48)
Removed loadConfigPolicy and loadPolicy functions since they do nothing Signed-off-by: kopaihorodskyi <a542e9b744bed>
1 parent 5f7f0b0 commit b5424d1

File tree

1 file changed

+7
-45
lines changed

1 file changed

+7
-45
lines changed

pkg/fab/chconfig/chconfig.go

Lines changed: 7 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -436,61 +436,23 @@ func loadConfig(configItems *ChannelCfg, versionsGroup *common.ConfigGroup, grou
436436
}
437437
}
438438

439-
return loadConfigGroupPolicies(versionsGroup, group)
439+
loadConfigGroupPolicies(versionsGroup, group)
440+
441+
return nil
440442
}
441443

442-
func loadConfigGroupPolicies(versionsGroup *common.ConfigGroup, group *common.ConfigGroup) error {
444+
func loadConfigGroupPolicies(versionsGroup *common.ConfigGroup, group *common.ConfigGroup) {
443445
policies := group.GetPolicies()
444446
if policies != nil {
445447
versionsGroup.Policies = make(map[string]*common.ConfigPolicy)
446448
for key, configPolicy := range policies {
447449
versionsGroup.Policies[key] = &common.ConfigPolicy{}
448-
err := loadConfigPolicy(versionsGroup.Policies[key], configPolicy)
449-
if err != nil {
450-
return err
451-
}
452-
}
453-
}
454-
455-
return nil
456450

457-
}
458-
459-
func loadConfigPolicy(versionsPolicy *common.ConfigPolicy, configPolicy *common.ConfigPolicy) error {
460-
versionsPolicy.Version = configPolicy.Version
461-
return loadPolicy(configPolicy.Policy)
462-
}
463-
464-
func loadPolicy(policy *common.Policy) error {
465-
466-
policyType := common.Policy_PolicyType(policy.Type)
467-
468-
switch policyType {
469-
case common.Policy_SIGNATURE:
470-
sigPolicyEnv := &common.SignaturePolicyEnvelope{}
471-
err := proto.Unmarshal(policy.Value, sigPolicyEnv)
472-
if err != nil {
473-
return errors.Wrap(err, "unmarshal signature policy envelope from config failed")
451+
versionsGroup.Policies[key].Version = configPolicy.Version
452+
versionsGroup.Policies[key].Policy = configPolicy.Policy
453+
versionsGroup.Policies[key].ModPolicy = configPolicy.ModPolicy
474454
}
475-
// TODO: Do something with this value
476-
477-
case common.Policy_MSP:
478-
// TODO: Not implemented yet
479-
480-
case common.Policy_IMPLICIT_META:
481-
implicitMetaPolicy := &common.ImplicitMetaPolicy{}
482-
err := proto.Unmarshal(policy.Value, implicitMetaPolicy)
483-
if err != nil {
484-
return errors.Wrap(err, "unmarshal implicit meta policy from config failed")
485-
}
486-
// TODO: Do something with this value
487-
case common.Policy_UNKNOWN:
488-
// TODO: Not implemented yet
489-
490-
default:
491-
return errors.Errorf("unknown policy type %v", policyType)
492455
}
493-
return nil
494456
}
495457

496458
func loadAnchorPeers(configValue *common.ConfigValue, configItems *ChannelCfg, org string) error {

0 commit comments

Comments
 (0)