Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion cmd/boost/direct_deal.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,10 @@ If the client id different then claim can be extended up to maximum 5 years from
Name: "all",
Usage: "automatically extend TermMax of all claims for specified miner[s] to --term-max (default: 5 years from claim start epoch)",
},
&cli.BoolFlag{
Name: "no-datacap",
Usage: "will only extend the claim expiration without requiring a datacap i.e. made with --wallet address",
},
&cli.StringSliceFlag{
Name: "miner",
Usage: "storage provider address[es]",
Expand Down Expand Up @@ -556,6 +560,11 @@ If the client id different then claim can be extended up to maximum 5 years from
all := cctx.Bool("all")
wallet := cctx.String("wallet")
tmax := cctx.Int64("term-max")
noDatacap := cctx.Bool("no-datacap")

if !all && noDatacap {
return fmt.Errorf("can't use --no-datacap flag without --all flag")
}

// No miner IDs and no arguments
if len(miners) == 0 && cctx.Args().Len() == 0 {
Expand Down Expand Up @@ -654,7 +663,7 @@ If the client id different then claim can be extended up to maximum 5 years from

log.Debugw("selected wallet", "wallet", walletAddr)

msgs, err := util.CreateExtendClaimMsg(ctx, gapi, claimMap, miners, walletAddr, abi.ChainEpoch(tmax), all, cctx.Bool("assume-yes"), cctx.Int("batch-size"))
msgs, err := util.CreateExtendClaimMsg(ctx, gapi, claimMap, miners, walletAddr, abi.ChainEpoch(tmax), all, cctx.Bool("assume-yes"), noDatacap, cctx.Int("batch-size"))
if err != nil {
return err
}
Expand Down
5 changes: 4 additions & 1 deletion cmd/boost/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ type PieceInfos struct {
// 6. Extend all claims for multiple miner IDs with different client address (2 messages)
// 7. Extend specified claims for a miner ID with different client address (2 messages)
// 8. Extend specific claims for specific miner ID with different client address (2 messages)
func CreateExtendClaimMsg(ctx context.Context, api api.Gateway, pcm map[verifreg13.ClaimId]ProvInfo, miners []string, wallet address.Address, tmax abi.ChainEpoch, all, assumeYes bool, batchSize int) ([]*types.Message, error) {
func CreateExtendClaimMsg(ctx context.Context, api api.Gateway, pcm map[verifreg13.ClaimId]ProvInfo, miners []string, wallet address.Address, tmax abi.ChainEpoch, all, assumeYes, noDatacap bool, batchSize int) ([]*types.Message, error) {
ac, err := api.StateLookupID(ctx, wallet, types.EmptyTSK)
if err != nil {
return nil, err
Expand Down Expand Up @@ -174,6 +174,9 @@ func CreateExtendClaimMsg(ctx context.Context, api api.Gateway, pcm map[verifreg
claim := c
// If the client is not the original client - burn datacap
if claim.Client != wid {
if noDatacap {
continue
}
// The new duration should be greater than the original deal duration and claim should not already be expired
if head.Height()+tmax-claim.TermStart > claim.TermMax-claim.TermStart && claim.TermStart+claim.TermMax > head.Height() {
req := verifreg13.ClaimExtensionRequest{
Expand Down