Skip to content

Commit b7bd8b7

Browse files
committed
[FAB-9758] Remove unused return value from Launch
All callers of launch discard the first return value so remove it. Change-Id: If1290f6c8423ac0b60ab2c3ef1d21788b4716ba7 Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
1 parent d9e9f5a commit b7bd8b7

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

core/chaincode/chaincode_support.go

+11-11
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,19 @@ func (cs *ChaincodeSupport) Stop(ctx context.Context, cccid *ccprovider.CCContex
169169
}
170170

171171
// 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.
172-
func (cs *ChaincodeSupport) Launch(context context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.ChaincodeID, *pb.ChaincodeInput, error) {
172+
func (cs *ChaincodeSupport) Launch(context context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.ChaincodeInput, error) {
173173
cname := cccid.GetCanonicalName()
174174
cID := spec.GetChaincodeSpec().ChaincodeId
175175
cMsg := spec.GetChaincodeSpec().Input
176176

177177
if cs.HandlerRegistry.Handler(cname) != nil {
178-
return cID, cMsg, nil
178+
return cMsg, nil
179179
}
180180

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

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

201201
cds = &pb.ChaincodeDeploymentSpec{}
202202

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

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

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

243-
chaincodeLogger.Debug("LaunchChaincode complete")
243+
chaincodeLogger.Debug("launch complete")
244244

245-
return cID, cMsg, nil
245+
return cMsg, nil
246246
}
247247

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

305-
_, cMsg, err := cs.Launch(ctxt, cccid, spec)
305+
cMsg, err := cs.Launch(ctxt, cccid, spec)
306306
if err != nil {
307307
return nil, nil, err
308308
}

core/chaincode/handler.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type Registry interface {
5555
// internal interface to scope dependencies on ChaincodeSupport
5656
type handlerSupport interface {
5757
GetChaincodeDefinition(ctxt context.Context, txid string, signedProp *pb.SignedProposal, prop *pb.Proposal, chainID string, chaincodeID string) (ccprovider.ChaincodeDefinition, error)
58-
Launch(context context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.ChaincodeID, *pb.ChaincodeInput, error)
58+
Launch(context context.Context, cccid *ccprovider.CCContext, spec ccprovider.ChaincodeSpecGetter) (*pb.ChaincodeInput, error)
5959
Execute(ctxt context.Context, cccid *ccprovider.CCContext, msg *pb.ChaincodeMessage, timeout time.Duration) (*pb.ChaincodeMessage, error)
6060
}
6161

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

0 commit comments

Comments
 (0)