Skip to content

Commit 03ebe88

Browse files
authored
add no-datacap flag to extend claim cmd (#2013)
1 parent 895593c commit 03ebe88

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

cmd/boost/direct_deal.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,10 @@ If the client id different then claim can be extended up to maximum 5 years from
522522
Name: "all",
523523
Usage: "automatically extend TermMax of all claims for specified miner[s] to --term-max (default: 5 years from claim start epoch)",
524524
},
525+
&cli.BoolFlag{
526+
Name: "no-datacap",
527+
Usage: "will only extend the claim expiration without requiring a datacap i.e. made with --wallet address",
528+
},
525529
&cli.StringSliceFlag{
526530
Name: "miner",
527531
Usage: "storage provider address[es]",
@@ -556,6 +560,11 @@ If the client id different then claim can be extended up to maximum 5 years from
556560
all := cctx.Bool("all")
557561
wallet := cctx.String("wallet")
558562
tmax := cctx.Int64("term-max")
563+
noDatacap := cctx.Bool("no-datacap")
564+
565+
if !all && noDatacap {
566+
return fmt.Errorf("can't use --no-datacap flag without --all flag")
567+
}
559568

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

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

657-
msgs, err := util.CreateExtendClaimMsg(ctx, gapi, claimMap, miners, walletAddr, abi.ChainEpoch(tmax), all, cctx.Bool("assume-yes"), cctx.Int("batch-size"))
666+
msgs, err := util.CreateExtendClaimMsg(ctx, gapi, claimMap, miners, walletAddr, abi.ChainEpoch(tmax), all, cctx.Bool("assume-yes"), noDatacap, cctx.Int("batch-size"))
658667
if err != nil {
659668
return err
660669
}

cmd/boost/util/util.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ type PieceInfos struct {
133133
// 6. Extend all claims for multiple miner IDs with different client address (2 messages)
134134
// 7. Extend specified claims for a miner ID with different client address (2 messages)
135135
// 8. Extend specific claims for specific miner ID with different client address (2 messages)
136-
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) {
136+
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) {
137137
ac, err := api.StateLookupID(ctx, wallet, types.EmptyTSK)
138138
if err != nil {
139139
return nil, err
@@ -174,6 +174,9 @@ func CreateExtendClaimMsg(ctx context.Context, api api.Gateway, pcm map[verifreg
174174
claim := c
175175
// If the client is not the original client - burn datacap
176176
if claim.Client != wid {
177+
if noDatacap {
178+
continue
179+
}
177180
// The new duration should be greater than the original deal duration and claim should not already be expired
178181
if head.Height()+tmax-claim.TermStart > claim.TermMax-claim.TermStart && claim.TermStart+claim.TermMax > head.Height() {
179182
req := verifreg13.ClaimExtensionRequest{

0 commit comments

Comments
 (0)