Skip to content

Commit

Permalink
fix rDataCap datacap (filecoin-project#11811)
Browse files Browse the repository at this point in the history
  • Loading branch information
beck-8 authored Apr 8, 2024
1 parent dd6fef8 commit e68b762
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions cli/filplus.go
Original file line number Diff line number Diff line change
Expand Up @@ -1311,21 +1311,6 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre
}

if len(newClaims) > 0 {
// Get datacap balance
aDataCap, err := api.StateVerifiedClientStatus(ctx, wallet, types.EmptyTSK)
if err != nil {
return nil, err
}

if aDataCap == nil {
return nil, xerrors.Errorf("wallet %s does not have any datacap", wallet)
}

// Check that we have enough data cap to make the allocation
if rDataCap.GreaterThan(big.NewInt(aDataCap.Int64())) {
return nil, xerrors.Errorf("requested datacap %s is greater then the available datacap %s", rDataCap, aDataCap)
}

if !assumeYes {
out := fmt.Sprintf("Some of the specified allocation have a different client address and will require %d Datacap to extend. Proceed? Yes [Y/y] / No [N/n], Ctrl+C (^C) to exit", rDataCap.Int)
validate := func(input string) error {
Expand Down Expand Up @@ -1361,6 +1346,21 @@ func CreateExtendClaimMsg(ctx context.Context, api api.FullNode, pcm map[verifre
}
}

// Get datacap balance
aDataCap, err := api.StateVerifiedClientStatus(ctx, wallet, types.EmptyTSK)
if err != nil {
return nil, err
}

if aDataCap == nil {
return nil, xerrors.Errorf("wallet %s does not have any datacap", wallet)
}

// Check that we have enough data cap to make the allocation
if rDataCap.GreaterThan(big.NewInt(aDataCap.Int64())) {
return nil, xerrors.Errorf("requested datacap %s is greater then the available datacap %s", rDataCap, aDataCap)
}

// Create a map of just keys, so we can easily batch based on the numeric keys
keys := make([]verifregtypes13.ClaimExtensionRequest, 0, len(newClaims))
for k := range newClaims {
Expand Down

0 comments on commit e68b762

Please sign in to comment.