MCPcopy
hub / github.com/hyperledger/fabric / ChaincodeEndorsementInfo

Method ChaincodeEndorsementInfo

core/scc/lscc/lscc.go:255–286  ·  view source on GitHub ↗
(channelID, chaincodeName string, qe ledger.SimpleQueryExecutor)

Source from the content-addressed store, hash-verified

253}
254
255func (lscc *SCC) ChaincodeEndorsementInfo(channelID, chaincodeName string, qe ledger.SimpleQueryExecutor) (*lifecycle.ChaincodeEndorsementInfo, error) {
256 chaincodeDataBytes, err := qe.GetState("lscc", chaincodeName)
257 if err != nil {
258 return nil, errors.Wrapf(err, "could not retrieve state for chaincode %s", chaincodeName)
259 }
260
261 if chaincodeDataBytes == nil {
262 return nil, errors.Errorf("chaincode %s not found", chaincodeName)
263 }
264
265 chaincodeData := &ccprovider.ChaincodeData{}
266 err = proto.Unmarshal(chaincodeDataBytes, chaincodeData)
267 if err != nil {
268 return nil, errors.Wrapf(err, "chaincode %s has bad definition", chaincodeName)
269 }
270
271 ls := &LegacySecurity{
272 Support: lscc.Support,
273 PackageCache: &lscc.PackageCache,
274 }
275
276 err = ls.SecurityCheckLegacyChaincode(chaincodeData)
277 if err != nil {
278 return nil, errors.WithMessage(err, "failed security checks")
279 }
280
281 return &lifecycle.ChaincodeEndorsementInfo{
282 Version: chaincodeData.Version,
283 EndorsementPlugin: chaincodeData.Escc,
284 ChaincodeID: chaincodeData.Name + ":" + chaincodeData.Version,
285 }, nil
286}
287
288// ValidationInfo returns name&arguments of the validation plugin for the supplied chaincode.
289// The function returns two types of errors, unexpected errors and validation errors. The

Callers

nothing calls this directly

Calls 4

GetStateMethod · 0.65
ErrorfMethod · 0.65
UnmarshalMethod · 0.65

Tested by

no test coverage detected