Skip to content

Commit

Permalink
Setter crashes because of immutable emptyList() (#117)
Browse files Browse the repository at this point in the history
Signed-off-by: S m, Aruna <aruna.mohan@walmart.com>
  • Loading branch information
arsulegai authored Dec 28, 2023
1 parent c395dd1 commit ff1c679
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ private static Configtx.ConfigPolicy getDefaultRoleConfigPolicyForMSP(
// set rules
// create those roles
Policies.SignaturePolicyEnvelope.Builder signaturePolicyEnvelopeBuilder =
Policies.SignaturePolicyEnvelope.newBuilder();
Policies.SignaturePolicyEnvelope.newBuilder().addAllIdentities(mspPrincipals);
Policies.SignaturePolicy.Builder signaturePolicyBuilder = Policies.SignaturePolicy.newBuilder();
Policies.SignaturePolicy.NOutOf.Builder signatureNOutOfBuilder =
Policies.SignaturePolicy.NOutOf.newBuilder().setN(1); // expect just one signature always
List<Policies.SignaturePolicy> signaturePolicies = new ArrayList<>();
for (int idx = 0; idx < mspPrincipals.size(); idx++) {
signaturePolicyEnvelopeBuilder.setIdentities(idx, mspPrincipals.get(idx));
signatureNOutOfBuilder.setRules(
idx, Policies.SignaturePolicy.newBuilder().setSignedBy(idx).build());
signaturePolicies.add(Policies.SignaturePolicy.newBuilder().setSignedBy(idx).build());
}
signatureNOutOfBuilder.addAllRules(signaturePolicies);
signaturePolicyBuilder.setNOutOf(signatureNOutOfBuilder.build());
signaturePolicyEnvelopeBuilder.setRule(signaturePolicyBuilder.build());
// get the policy
Expand Down

0 comments on commit ff1c679

Please sign in to comment.