Skip to content

Commit

Permalink
[FAB-9758] Remove unused return value from Launch
Browse files Browse the repository at this point in the history
All callers of launch discard the first return value so remove it.

Change-Id: If1290f6c8423ac0b60ab2c3ef1d21788b4716ba7
Signed-off-by: Matthew Sykes <[email protected]>
  • Loading branch information
sykesm committed May 2, 2018
1 parent d9e9f5a commit b7bd8b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions core/chaincode/chaincode_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,19 @@ func (cs *ChaincodeSupport) Stop(ctx context.Context, cccid *ccprovider.CCContex
}

// Launch will launch the chaincode if not running (if running return nil) and will wait for handler of the chaincode to get into ready state.
func (cs *ChaincodeSupport) Launch(context context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.ChaincodeID, *pb.ChaincodeInput, error) {
func (cs *ChaincodeSupport) Launch(context context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.ChaincodeInput, error) {
cname := cccid.GetCanonicalName()
cID := spec.GetChaincodeSpec().ChaincodeId
cMsg := spec.GetChaincodeSpec().Input

if cs.HandlerRegistry.Handler(cname) != nil {
return cID, cMsg, nil
return cMsg, nil
}

cds, _ := spec.(*pb.ChaincodeDeploymentSpec)
if cds == nil {
if cccid.Syscc {
return cID, cMsg, errors.Errorf("a syscc should be running (it cannot be launched) %s", cname)
return cMsg, errors.Errorf("a syscc should be running (it cannot be launched) %s", cname)
}

if cs.userRunsCC {
Expand All @@ -192,18 +192,18 @@ func (cs *ChaincodeSupport) Launch(context context.Context, cccid *ccprovider.CC
//(this will also validate the ID from the LSCC if we're not using the config-tree approach)
depPayload, err := cs.GetCDS(context, cccid.TxID, cccid.SignedProposal, cccid.Proposal, cccid.ChainID, cID.Name)
if err != nil {
return cID, cMsg, errors.WithMessage(err, fmt.Sprintf("could not get ChaincodeDeploymentSpec for %s", cname))
return cMsg, errors.WithMessage(err, fmt.Sprintf("could not get ChaincodeDeploymentSpec for %s", cname))
}
if depPayload == nil {
return cID, cMsg, errors.WithMessage(err, fmt.Sprintf("nil ChaincodeDeploymentSpec for %s", cname))
return cMsg, errors.WithMessage(err, fmt.Sprintf("nil ChaincodeDeploymentSpec for %s", cname))
}

cds = &pb.ChaincodeDeploymentSpec{}

//Get lang from original deployment
err = proto.Unmarshal(depPayload, cds)
if err != nil {
return cID, cMsg, errors.Wrap(err, fmt.Sprintf("failed to unmarshal deployment transactions for %s", cname))
return cMsg, errors.Wrap(err, fmt.Sprintf("failed to unmarshal deployment transactions for %s", cname))
}
}

Expand All @@ -225,7 +225,7 @@ func (cs *ChaincodeSupport) Launch(context context.Context, cccid *ccprovider.CC
if !(cs.userRunsCC || cds.ExecEnv == pb.ChaincodeDeploymentSpec_SYSTEM) {
ccpack, err := cs.PackageProvider.GetChaincode(cID.Name, cID.Version)
if err != nil {
return cID, cMsg, err
return cMsg, err
}

cds = ccpack.GetDepSpec()
Expand All @@ -236,13 +236,13 @@ func (cs *ChaincodeSupport) Launch(context context.Context, cccid *ccprovider.CC
err := cs.launchAndWaitForReady(context, cccid, cds)
if err != nil {
chaincodeLogger.Errorf("launchAndWaitForReady failed: %+v", err)
return cID, cMsg, err
return cMsg, err
}
}

chaincodeLogger.Debug("LaunchChaincode complete")
chaincodeLogger.Debug("launch complete")

return cID, cMsg, nil
return cMsg, nil
}

// HandleChaincodeStream implements ccintf.HandleChaincodeStream for all vms to call with appropriate stream
Expand Down Expand Up @@ -302,7 +302,7 @@ func (cs *ChaincodeSupport) ExecuteSpec(ctxt context.Context, cccid *ccprovider.
cctyp = pb.ChaincodeMessage_TRANSACTION
}

_, cMsg, err := cs.Launch(ctxt, cccid, spec)
cMsg, err := cs.Launch(ctxt, cccid, spec)
if err != nil {
return nil, nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions core/chaincode/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Registry interface {
// internal interface to scope dependencies on ChaincodeSupport
type handlerSupport interface {
GetChaincodeDefinition(ctxt context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string) (ccprovider.ChaincodeDefinition, error)
Launch(context context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.ChaincodeID, *pb.ChaincodeInput, error)
Launch(context context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.ChaincodeInput, error)
Execute(ctxt context.Context, cccid *ccprovider.CCContext, msg *pb.ChaincodeMessage, timeout time.Duration) (*pb.ChaincodeMessage, error)
}

Expand Down Expand Up @@ -1118,7 +1118,7 @@ func (h *Handler) handleModState(msg *pb.ChaincodeMessage) {
chaincodeLogger.Debugf("[%s] launching chaincode %s on channel %s",
shorttxid(msg.Txid), calledCcIns.ChaincodeName, calledCcIns.ChainID)
cciSpec := &pb.ChaincodeInvocationSpec{ChaincodeSpec: chaincodeSpec}
_, chaincodeInput, launchErr := h.handlerSupport.Launch(ctxt, cccid, cciSpec)
chaincodeInput, launchErr := h.handlerSupport.Launch(ctxt, cccid, cciSpec)
if launchErr != nil {
payload := []byte(launchErr.Error())
chaincodeLogger.Debugf("[%s]Failed to launch invoked chaincode. Sending %s",
Expand Down

0 comments on commit b7bd8b7

Please sign in to comment.