Skip to content

Commit d881a6c

Browse files
author
Jason Yellick
committed
[FAB-2455] Fix misleading log statment
https://jira.hyperledger.org/browse/FAB-2455 The endorsement policy evaluation misleadingly calls all policies write policies, this CR fixes this to specify the policy name selected. Change-Id: Ibcf98694ba3023539590be6b27e334e232d8146e Signed-off-by: Jason Yellick <[email protected]>
1 parent 6fde439 commit d881a6c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

core/endorser/endorser.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,15 @@ func (*Endorser) checkACL(signedProp *pb.SignedProposal, chdr *common.ChannelHea
6767
}
6868

6969
// access the policy to use to validate this proposal
70-
var policy policies.Policy
70+
var policyName string
7171
if syscc.IsSysCC(hdrext.ChaincodeId.Name) {
7272
// in the case of a system chaincode, we use the admin policy
73-
policy, _ = pm.GetPolicy(policies.ChannelApplicationAdmins)
73+
policyName = policies.ChannelApplicationAdmins
7474
} else {
7575
// in the case of a normal chaincode, we use the writers policy
76-
policy, _ = pm.GetPolicy(policies.ChannelApplicationWriters)
76+
policyName = policies.ChannelApplicationWriters
7777
}
78+
policy, _ := pm.GetPolicy(policyName)
7879

7980
// evaluate that this proposal complies with the writers
8081
err := policy.Evaluate(
@@ -84,7 +85,8 @@ func (*Endorser) checkACL(signedProp *pb.SignedProposal, chdr *common.ChannelHea
8485
Signature: signedProp.Signature,
8586
}})
8687
if err != nil {
87-
return fmt.Errorf("The proposal does not comply with the channel writers for channel %s, error %s",
88+
return fmt.Errorf("The proposal does not comply with the %s for channel %s, error %s",
89+
policyName,
8890
chdr.ChannelId,
8991
err)
9092
}

0 commit comments

Comments
 (0)