From e68b762b40cd650410d5b203c578e196f32427d9 Mon Sep 17 00:00:00 2001 From: beck <34204218+beck-8@users.noreply.github.com> Date: Mon, 8 Apr 2024 16:06:34 +0800 Subject: [PATCH] fix rDataCap datacap (#11811) --- cli/filplus.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/cli/filplus.go b/cli/filplus.go index b8e887498..7b876ea32 100644 --- a/cli/filplus.go +++ b/cli/filplus.go @@ -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 { @@ -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 {