// Select selects min number of witnesses required based on witness policy.
Select selects min number of witnesses required based on witness policy.
// Select selects min number of witnesses required based on witness policy .
func (wp *WitnessPolicy) Select(witnesses []*proof.Witness, exclude ...*proof.Witness) ([]*proof.Witness, error) {
	cfg, err := wp.getWitnessPolicyConfig()
	if err != nil {
		return nil, err
	}
	selectedBatchWitnesses, selectedSystemWitnesses, err := wp.selectBatchAndSystemWitnesses(witnesses, cfg, exclude...)
	if err != nil {
		return nil, err
	}
	if cfg.Operator == config.AND {
		return append(selectedBatchWitnesses, selectedSystemWitnesses...), nil
	}
	if len(selectedBatchWitnesses) == 0 || len(selectedSystemWitnesses) < len(selectedBatchWitnesses) {
		return selectedSystemWitnesses, nil
	}
	return selectedBatchWitnesses, nil
}
func ( wp * WitnessPolicy ) Select ( witnesses [ ] * proof . Witness , exclude ... * proof . Witness ) ( [ ] * proof . Witness , error ) { cfg , err := wp . getWitnessPolicyConfig ( ) if err != nil { return nil , err } selectedBatchWitnesses , selectedSystemWitnesses , err := wp . selectBatchAndSystemWitnesses ( witnesses , cfg , exclude ... ) if err != nil { return nil , err } if cfg . Operator == config . AND { return append ( selectedBatchWitnesses , selectedSystemWitnesses ... ) , nil } if len ( selectedBatchWitnesses ) == 0 || len ( selectedSystemWitnesses ) < len ( selectedBatchWitnesses ) { return selectedSystemWitnesses , nil } return selectedBatchWitnesses , nil }
Select selects min number of witnesses required based on witness policy.
Select selects min number of witnesses required based on witness policy .