Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FABGW-20 Implement TargetOrgs for Evaluate() #2642

Merged
merged 1 commit into from
Jun 7, 2021

Conversation

andrew-coleman
Copy link
Member

  • Implement the TargetOrganizations grpc option for the Evaluate() method.
  • Rewrite logic of Evaluate() to prefer querying the local org

Signed-off-by: andrew-coleman andrew_coleman@uk.ibm.com

@andrew-coleman andrew-coleman requested a review from a team as a code owner June 4, 2021 16:12
Copy link
Contributor

@manish-sethi manish-sethi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrew-coleman - just a minor comment

Comment on lines 160 to 179
if contains(endorsingOrgs, endorser.mspid) && member.Properties != nil {
for _, installedChaincode := range member.Properties.Chaincodes {
// only consider the peers that have our chaincode installed
if installedChaincode.Name == chaincode {
endorsersByOrg[endorser.mspid] = append(endorsersByOrg[endorser.mspid], &endorserState{endorser: endorser, height: member.Properties.LedgerHeight})
}
for _, installedChaincode := range member.Properties.Chaincodes {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the existing code, there was a nil check for member.Properties. This patch removed that check. If the intention was to take advantage of the built-in nil check in the protobuf library code, you need to use the function GetChaincodes instead of accessing the field directly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good suggestion, thank you

Copy link
Contributor

@manish-sethi manish-sethi Jun 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be better to add a UT for this situation if it's simple enough, so a test failure could have caught it. You can do that in a separate PR.

- Implement the TargetOrganizations grpc option for the Evaluate() method.
- Rewrite logic of Evaluate() to prefer querying the local org

Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
@manish-sethi manish-sethi merged commit a8dbb68 into hyperledger:main Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants