Skip to content

Commit 579101d

Browse files
committed
Endorser gets ESCC from ChaincodeData
This change request extracts the ESCC that is to be used to endorse a given chaincode from the ChaincodeData struct returned by LCCC instead of using the hardcoded "escc" string as it was done previously. Change-Id: I94648a0556b7729d69af476c6ed25b23728cd85b Signed-off-by: Alessandro Sorniotti <[email protected]>
1 parent 7104614 commit 579101d

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

core/endorser/endorser.go

+5-8
Original file line numberDiff line numberDiff line change
@@ -226,20 +226,17 @@ func (e *Endorser) getCDSFromLCCC(ctx context.Context, chainID string, txid stri
226226
func (e *Endorser) endorseProposal(ctx context.Context, chainID string, txid string, proposal *pb.Proposal, response *pb.Response, simRes []byte, event *pb.ChaincodeEvent, visibility []byte, ccid *pb.ChaincodeID, txsim ledger.TxSimulator, cd *ccprovider.ChaincodeData) (*pb.ProposalResponse, error) {
227227
endorserLogger.Infof("endorseProposal starts for chainID %s, ccid %s", chainID, ccid)
228228

229-
// 1) extract the chaincodeDeploymentSpec for the chaincode we are invoking; we need it to get the escc
229+
// 1) extract the name of the escc that is requested to endorse this chaincode
230230
var escc string
231-
232231
//ie, not "lccc" or system chaincodes
233232
if cd != nil {
234-
_, err := putils.GetChaincodeDeploymentSpec(cd.DepSpec)
235-
if err != nil {
236-
return nil, fmt.Errorf("failed to unmarshal cds for %s - %s", ccid, err)
233+
escc = cd.Escc
234+
if escc == "" { // this should never happen, LCCC always fills this field
235+
panic("No ESCC specified in ChaincodeData")
237236
}
238-
239-
// FIXME: pick the right escc from cds - currently cds doesn't have this info
240-
escc = "escc"
241237
} else {
242238
// FIXME: getCDSFromLCCC seems to fail for lccc - not sure this is expected?
239+
// TODO: who should endorse a call to LCCC?
243240
escc = "escc"
244241
}
245242

0 commit comments

Comments
 (0)