ValidateNetworkChannelFanoutConfiguration checks policy and coordinator coupling for channel metadata.
(policy string, coordinatorPeerID string)
| 876 | // ValidateNetworkChannelFanoutConfiguration checks policy and coordinator |
| 877 | // coupling for channel metadata. |
| 878 | func ValidateNetworkChannelFanoutConfiguration(policy string, coordinatorPeerID string) error { |
| 879 | normalized := NormalizeNetworkFanoutPolicy(policy) |
| 880 | if err := ValidateNetworkFanoutPolicy(normalized); err != nil { |
| 881 | return err |
| 882 | } |
| 883 | coordinator := strings.TrimSpace(coordinatorPeerID) |
| 884 | if normalized == NetworkFanoutPolicyCoordinator { |
| 885 | if coordinator == "" { |
| 886 | return errors.New("store: network channel coordinator_peer_id is required for coordinator fanout policy") |
| 887 | } |
| 888 | return nil |
| 889 | } |
| 890 | if coordinator != "" { |
| 891 | return errors.New("store: network channel coordinator_peer_id requires coordinator fanout policy") |
| 892 | } |
| 893 | return nil |
| 894 | } |
| 895 | |
| 896 | // NormalizeNetworkFanoutPolicy applies the default channel activation policy. |
| 897 | func NormalizeNetworkFanoutPolicy(policy string) string { |
no test coverage detected