fix: cancel retrieval deal - disallow negative deal ID

This commit is contained in:
Dirk McCormick 2021-03-26 09:50:52 +01:00
parent 36c3086376
commit b13f6a3209
2 changed files with 3 additions and 3 deletions

View File

@ -1996,7 +1996,7 @@ var clientCancelRetrievalDeal = &cli.Command{
defer closer() defer closer()
ctx := ReqContext(cctx) ctx := ReqContext(cctx)
if cctx.Int64("dealid") <= 0 { if cctx.Int64("dealid") < 0 {
return errors.New("deal id cannot be negative") return errors.New("deal id cannot be negative")
} }

View File

@ -489,12 +489,12 @@ func (a *API) ClientCancelRetrievalDeal(ctx context.Context, dealid retrievalmar
select { select {
case err := <-cerr: case err := <-cerr:
if err != nil { if err != nil {
return xerrors.Errorf("canceling retrieval deal erred: %w", err) return xerrors.Errorf("failed to cancel retrieval deal: %w", err)
} }
return nil return nil
case <-ctx.Done(): case <-ctx.Done():
return xerrors.Errorf("canceling retrieval deal context timeout: %w", ctx.Err()) return xerrors.Errorf("context timeout while canceling retrieval deal: %w", ctx.Err())
} }
} }