Skip to content

Commit

Permalink
Reword evaluate() error message
Browse files Browse the repository at this point in the history
When no suitable peers are available to evaluate a transaction, the registry returns an error.  The message should be reworded to make clear it is being used for evaluation rather than endorsement.

Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
  • Loading branch information
andrew-coleman authored and ale-linux committed Nov 10, 2021
1 parent 688d4d2 commit f089b24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/pkg/gateway/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func TestEvaluate(t *testing.T) {
name: "no endorsers",
plan: endorsementPlan{},
members: []networkMember{},
errString: "rpc error: code = Unavailable desc = no endorsing peers found for chaincode test_chaincode in channel test_channel",
errString: "rpc error: code = Unavailable desc = no peers available to evaluate chaincode test_chaincode in channel test_channel",
},
{
name: "five endorsers, prefer local org",
Expand Down Expand Up @@ -277,7 +277,7 @@ func TestEvaluate(t *testing.T) {
{"id5", "peer4:11051", "msp3", 7},
},
transientData: map[string][]byte{"transient-key": []byte("transient-value")},
errString: "rpc error: code = Unavailable desc = no endorsers found in the gateway's organization; retry specifying target organization(s) to protect transient data: no endorsing peers found for chaincode test_chaincode in channel test_channel",
errString: "rpc error: code = Unavailable desc = no endorsers found in the gateway's organization; retry specifying target organization(s) to protect transient data: no peers available to evaluate chaincode test_chaincode in channel test_channel",
},
{
name: "evaluate with transient data and target (non-local) orgs should select the highest block height peer",
Expand Down Expand Up @@ -399,7 +399,7 @@ func TestEvaluate(t *testing.T) {
PKIid: []byte("ill-defined"),
}})
},
errString: "rpc error: code = Unavailable desc = no endorsing peers found for chaincode test_chaincode in channel test_channel",
errString: "rpc error: code = Unavailable desc = no peers available to evaluate chaincode test_chaincode in channel test_channel",
},
}
for _, tt := range tests {
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/gateway/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (reg *registry) evaluator(channel string, chaincode string, targetOrgs []st
groupEndorsers := map[string][]*endorser{"g1": allEndorsers}
return newPlan(layout, groupEndorsers), nil
}
return nil, fmt.Errorf("no endorsing peers found for chaincode %s in channel %s", chaincode, channel)
return nil, fmt.Errorf("no peers available to evaluate chaincode %s in channel %s", chaincode, channel)
}

func sorter(e []*endorserState, host string) func(i, j int) bool {
Expand Down

0 comments on commit f089b24

Please sign in to comment.