Treat proposed deals as manual iff a commP is provided

This commit is contained in:
Aayush Rajasekaran 2020-04-05 23:30:11 -04:00
parent fc933858e1
commit efd435d763

View File

@ -160,17 +160,13 @@ var clientDealCmd = &cli.Command{
Usage: "Initialize storage deal with a miner", Usage: "Initialize storage deal with a miner",
ArgsUsage: "[dataCid miner price duration]", ArgsUsage: "[dataCid miner price duration]",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.BoolFlag{
Name: "manual-transfer",
Usage: "data will be transferred out of band",
},
&cli.StringFlag{ &cli.StringFlag{
Name: "manual-piece-cid", Name: "manual-piece-cid",
Usage: "manually specify piece commitment for data", Usage: "manually specify piece commitment for data (dataCid must be to a car file)",
}, },
&cli.Int64Flag{ &cli.Int64Flag{
Name: "manual-piece-size", Name: "manual-piece-size",
Usage: "if manually specifying piece cid, used to specify size", Usage: "if manually specifying piece cid, used to specify size (dataCid must be to a car file)",
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "from", Name: "from",
@ -189,7 +185,7 @@ var clientDealCmd = &cli.Command{
return xerrors.New("expected 4 args: dataCid, miner, price, duration") return xerrors.New("expected 4 args: dataCid, miner, price, duration")
} }
// [data, miner, dur] // [data, miner, price, dur]
data, err := cid.Parse(cctx.Args().Get(0)) data, err := cid.Parse(cctx.Args().Get(0))
if err != nil { if err != nil {
@ -230,9 +226,6 @@ var clientDealCmd = &cli.Command{
TransferType: storagemarket.TTGraphsync, TransferType: storagemarket.TTGraphsync,
Root: data, Root: data,
} }
if cctx.Bool("manual-transfer") {
ref.TransferType = storagemarket.TTManual
}
if mpc := cctx.String("manual-piece-cid"); mpc != "" { if mpc := cctx.String("manual-piece-cid"); mpc != "" {
c, err := cid.Parse(mpc) c, err := cid.Parse(mpc)
@ -248,6 +241,8 @@ var clientDealCmd = &cli.Command{
} }
ref.PieceSize = abi.UnpaddedPieceSize(psize) ref.PieceSize = abi.UnpaddedPieceSize(psize)
ref.TransferType = storagemarket.TTManual
} }
proposal, err := api.ClientStartDeal(ctx, &lapi.StartDealParams{ proposal, err := api.ClientStartDeal(ctx, &lapi.StartDealParams{