use proper manual piece and size setting
This commit is contained in:
parent
2be2891647
commit
52acfb88ee
@ -309,8 +309,6 @@ type StartDealParams struct {
|
||||
Miner address.Address
|
||||
EpochPrice types.BigInt
|
||||
BlocksDuration uint64
|
||||
|
||||
PieceCommitment *cid.Cid
|
||||
}
|
||||
|
||||
type ActiveSync struct {
|
||||
|
@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -91,6 +92,10 @@ var clientDealCmd = &cli.Command{
|
||||
Name: "manual-piece-cid",
|
||||
Usage: "manually specify piece commitment for data",
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
Name: "manual-piece-size",
|
||||
Usage: "if manually specifying piece cid, used to specify size",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
@ -139,23 +144,28 @@ var clientDealCmd = &cli.Command{
|
||||
ref.TransferType = storagemarket.TTManual
|
||||
}
|
||||
|
||||
var pcid *cid.Cid
|
||||
if mpc := cctx.String("manual-piece-cid"); mpc != "" {
|
||||
c, err := cid.Parse(mpc)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to parse provided manual piece cid: %w", err)
|
||||
}
|
||||
|
||||
pcid = &c
|
||||
ref.PieceCid = &c
|
||||
|
||||
psize := cctx.Int64("manual-piece-size")
|
||||
if psize == 0 {
|
||||
return xerrors.Errorf("must specify piece size when manually setting cid")
|
||||
}
|
||||
|
||||
ref.PieceSize = abi.UnpaddedPieceSize(psize)
|
||||
}
|
||||
|
||||
proposal, err := api.ClientStartDeal(ctx, &lapi.StartDealParams{
|
||||
Data: ref,
|
||||
Wallet: a,
|
||||
Miner: miner,
|
||||
EpochPrice: types.BigInt(price),
|
||||
BlocksDuration: uint64(dur),
|
||||
PieceCommitment: pcid,
|
||||
Data: ref,
|
||||
Wallet: a,
|
||||
Miner: miner,
|
||||
EpochPrice: types.BigInt(price),
|
||||
BlocksDuration: uint64(dur),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
2
go.mod
2
go.mod
@ -18,7 +18,7 @@ require (
|
||||
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03
|
||||
github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce
|
||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5
|
||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200303015849-1159079679ca
|
||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200304003055-d449a980d4bd
|
||||
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6
|
||||
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663
|
||||
github.com/filecoin-project/go-sectorbuilder v0.0.2-0.20200228181617-f00e2c4cc050
|
||||
|
2
go.sum
2
go.sum
@ -114,6 +114,8 @@ github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5 h1
|
||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20200208005934-2b8bd03caca5/go.mod h1:JbkIgFF/Z9BDlvrJO1FuKkaWsH673/UdFaiVS6uIHlA=
|
||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200303015849-1159079679ca h1:EccB/LgjrA6EVSpaVDfQyWe1DS3c0x1DcASBQ8beUdg=
|
||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200303015849-1159079679ca/go.mod h1:rfRwhd3ujcCXnD4N9oEM2wjh8GRZGoeNXME+UPG/9ts=
|
||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200304003055-d449a980d4bd h1:tLOl4GWJKQjpjqvSYSW0FoIjhoAzJSEoRibqkVFlaCE=
|
||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200304003055-d449a980d4bd/go.mod h1:rfRwhd3ujcCXnD4N9oEM2wjh8GRZGoeNXME+UPG/9ts=
|
||||
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6 h1:92PET+sx1Hb4W/8CgFwGuxaKbttwY+UNspYZTvXY0vs=
|
||||
github.com/filecoin-project/go-padreader v0.0.0-20200210211231-548257017ca6/go.mod h1:0HgYnrkeSU4lu1p+LEOeDpFsNBssa0OGGriWdA4hvaE=
|
||||
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663 h1:eYxi6vI5CyeXD15X1bB3bledDXbqKxqf0wQzTLgwYwA=
|
||||
|
@ -92,6 +92,7 @@ func (a *API) ClientStartDeal(ctx context.Context, params *api.StartDealParams)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed getting chain height: %w", err)
|
||||
}
|
||||
|
||||
result, err := a.SMDealClient.ProposeStorageDeal(
|
||||
ctx,
|
||||
params.Wallet,
|
||||
|
Loading…
Reference in New Issue
Block a user