diff --git a/api/api_full.go b/api/api_full.go index 55e958850..fe61afa26 100644 --- a/api/api_full.go +++ b/api/api_full.go @@ -609,14 +609,15 @@ type MethodCall struct { } type StartDealParams struct { - Data *storagemarket.DataRef - Wallet address.Address - Miner address.Address - EpochPrice types.BigInt - MinBlocksDuration uint64 - DealStartEpoch abi.ChainEpoch - FastRetrieval bool - VerifiedDeal bool + Data *storagemarket.DataRef + Wallet address.Address + Miner address.Address + EpochPrice types.BigInt + MinBlocksDuration uint64 + ProviderCollateral big.Int + DealStartEpoch abi.ChainEpoch + FastRetrieval bool + VerifiedDeal bool } type IpldObject struct { diff --git a/cli/client.go b/cli/client.go index 0e70a6faa..968146cc4 100644 --- a/cli/client.go +++ b/cli/client.go @@ -311,6 +311,10 @@ var clientDealCmd = &cli.Command{ Usage: "indicate that the deal counts towards verified client total", Value: false, }, + &cli.StringFlag{ + Name: "provider-collateral", + Usage: "specify the requested provider collateral the miner should put up", + }, &CidBaseFlag, }, Action: func(cctx *cli.Context) error { @@ -351,6 +355,15 @@ var clientDealCmd = &cli.Command{ return err } + var provCol big.Int + if pcs := cctx.String("provider-collateral"); pc != "" { + pc, err := big.FromString(pc) + if err != nil { + return fmt.Errorf("failed to parse provider-collateral: %w", err) + } + provCol = pc + } + if abi.ChainEpoch(dur) < build.MinDealDuration { return xerrors.Errorf("minimum deal duration is %d blocks", build.MinDealDuration) } @@ -415,14 +428,15 @@ var clientDealCmd = &cli.Command{ } proposal, err := api.ClientStartDeal(ctx, &lapi.StartDealParams{ - Data: ref, - Wallet: a, - Miner: miner, - EpochPrice: types.BigInt(price), - MinBlocksDuration: uint64(dur), - DealStartEpoch: abi.ChainEpoch(cctx.Int64("start-epoch")), - FastRetrieval: cctx.Bool("fast-retrieval"), - VerifiedDeal: isVerified, + Data: ref, + Wallet: a, + Miner: miner, + EpochPrice: types.BigInt(price), + MinBlocksDuration: uint64(dur), + DealStartEpoch: abi.ChainEpoch(cctx.Int64("start-epoch")), + FastRetrieval: cctx.Bool("fast-retrieval"), + VerifiedDeal: isVerified, + ProviderCollateral: provCol, }) if err != nil { return err diff --git a/node/impl/client/client.go b/node/impl/client/client.go index 404487859..df9febe75 100644 --- a/node/impl/client/client.go +++ b/node/impl/client/client.go @@ -36,7 +36,6 @@ import ( "github.com/filecoin-project/go-multistore" "github.com/filecoin-project/go-padreader" "github.com/filecoin-project/specs-actors/actors/abi" - "github.com/filecoin-project/specs-actors/actors/abi/big" "github.com/filecoin-project/specs-actors/actors/builtin/miner" marketevents "github.com/filecoin-project/lotus/markets/loggers" @@ -157,7 +156,7 @@ func (a *API) ClientStartDeal(ctx context.Context, params *api.StartDealParams) StartEpoch: dealStart, EndEpoch: calcDealExpiration(params.MinBlocksDuration, md, dealStart), Price: params.EpochPrice, - Collateral: big.Zero(), + Collateral: params.ProviderCollateral, Rt: rt, FastRetrieval: params.FastRetrieval, VerifiedDeal: params.VerifiedDeal,