allow client to specify provider collateral
This commit is contained in:
parent
6c1ecb4d16
commit
eb2879ca22
@ -609,14 +609,15 @@ type MethodCall struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type StartDealParams struct {
|
type StartDealParams struct {
|
||||||
Data *storagemarket.DataRef
|
Data *storagemarket.DataRef
|
||||||
Wallet address.Address
|
Wallet address.Address
|
||||||
Miner address.Address
|
Miner address.Address
|
||||||
EpochPrice types.BigInt
|
EpochPrice types.BigInt
|
||||||
MinBlocksDuration uint64
|
MinBlocksDuration uint64
|
||||||
DealStartEpoch abi.ChainEpoch
|
ProviderCollateral big.Int
|
||||||
FastRetrieval bool
|
DealStartEpoch abi.ChainEpoch
|
||||||
VerifiedDeal bool
|
FastRetrieval bool
|
||||||
|
VerifiedDeal bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type IpldObject struct {
|
type IpldObject struct {
|
||||||
|
@ -311,6 +311,10 @@ var clientDealCmd = &cli.Command{
|
|||||||
Usage: "indicate that the deal counts towards verified client total",
|
Usage: "indicate that the deal counts towards verified client total",
|
||||||
Value: false,
|
Value: false,
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "provider-collateral",
|
||||||
|
Usage: "specify the requested provider collateral the miner should put up",
|
||||||
|
},
|
||||||
&CidBaseFlag,
|
&CidBaseFlag,
|
||||||
},
|
},
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
@ -351,6 +355,15 @@ var clientDealCmd = &cli.Command{
|
|||||||
return err
|
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 {
|
if abi.ChainEpoch(dur) < build.MinDealDuration {
|
||||||
return xerrors.Errorf("minimum deal duration is %d blocks", 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{
|
proposal, err := api.ClientStartDeal(ctx, &lapi.StartDealParams{
|
||||||
Data: ref,
|
Data: ref,
|
||||||
Wallet: a,
|
Wallet: a,
|
||||||
Miner: miner,
|
Miner: miner,
|
||||||
EpochPrice: types.BigInt(price),
|
EpochPrice: types.BigInt(price),
|
||||||
MinBlocksDuration: uint64(dur),
|
MinBlocksDuration: uint64(dur),
|
||||||
DealStartEpoch: abi.ChainEpoch(cctx.Int64("start-epoch")),
|
DealStartEpoch: abi.ChainEpoch(cctx.Int64("start-epoch")),
|
||||||
FastRetrieval: cctx.Bool("fast-retrieval"),
|
FastRetrieval: cctx.Bool("fast-retrieval"),
|
||||||
VerifiedDeal: isVerified,
|
VerifiedDeal: isVerified,
|
||||||
|
ProviderCollateral: provCol,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -36,7 +36,6 @@ import (
|
|||||||
"github.com/filecoin-project/go-multistore"
|
"github.com/filecoin-project/go-multistore"
|
||||||
"github.com/filecoin-project/go-padreader"
|
"github.com/filecoin-project/go-padreader"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"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"
|
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
|
|
||||||
marketevents "github.com/filecoin-project/lotus/markets/loggers"
|
marketevents "github.com/filecoin-project/lotus/markets/loggers"
|
||||||
@ -157,7 +156,7 @@ func (a *API) ClientStartDeal(ctx context.Context, params *api.StartDealParams)
|
|||||||
StartEpoch: dealStart,
|
StartEpoch: dealStart,
|
||||||
EndEpoch: calcDealExpiration(params.MinBlocksDuration, md, dealStart),
|
EndEpoch: calcDealExpiration(params.MinBlocksDuration, md, dealStart),
|
||||||
Price: params.EpochPrice,
|
Price: params.EpochPrice,
|
||||||
Collateral: big.Zero(),
|
Collateral: params.ProviderCollateral,
|
||||||
Rt: rt,
|
Rt: rt,
|
||||||
FastRetrieval: params.FastRetrieval,
|
FastRetrieval: params.FastRetrieval,
|
||||||
VerifiedDeal: params.VerifiedDeal,
|
VerifiedDeal: params.VerifiedDeal,
|
||||||
|
Loading…
Reference in New Issue
Block a user