Bugfix: actor withdraw CLI should depend on network version
This commit is contained in:
parent
d1e1f8bdce
commit
047f7e5015
@ -10,6 +10,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
@ -634,14 +636,21 @@ var walletMarketWithdraw = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var withdrawn abi.TokenAmount
|
nv, err := api.StateNetworkVersion(ctx, wait.TipSet)
|
||||||
if err := withdrawn.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Successfully withdrew %s FIL\n", withdrawn)
|
if nv >= network.Version14 {
|
||||||
if withdrawn != amt {
|
var withdrawn abi.TokenAmount
|
||||||
fmt.Printf("Note that this is less than the requested amount of %s FIL\n", amt)
|
if err := withdrawn.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Successfully withdrew %s FIL\n", withdrawn)
|
||||||
|
if withdrawn != amt {
|
||||||
|
fmt.Printf("Note that this is less than the requested amount of %s FIL\n", amt)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -6,6 +6,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
|
|
||||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||||
cbor "github.com/ipfs/go-ipld-cbor"
|
cbor "github.com/ipfs/go-ipld-cbor"
|
||||||
|
|
||||||
@ -280,6 +282,7 @@ var actorWithdrawCmd = &cli.Command{
|
|||||||
fmt.Printf("Requested rewards withdrawal in message %s\n", smsg.Cid())
|
fmt.Printf("Requested rewards withdrawal in message %s\n", smsg.Cid())
|
||||||
|
|
||||||
// wait for it to get mined into a block
|
// wait for it to get mined into a block
|
||||||
|
fmt.Println("using ", uint64(cctx.Int("confidence")))
|
||||||
wait, err := api.StateWaitMsg(ctx, smsg.Cid(), uint64(cctx.Int("confidence")))
|
wait, err := api.StateWaitMsg(ctx, smsg.Cid(), uint64(cctx.Int("confidence")))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -291,14 +294,21 @@ var actorWithdrawCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var withdrawn abi.TokenAmount
|
nv, err := api.StateNetworkVersion(ctx, wait.TipSet)
|
||||||
if err := withdrawn.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Successfully withdrew %s FIL\n", withdrawn)
|
if nv >= network.Version14 {
|
||||||
if withdrawn != amount {
|
var withdrawn abi.TokenAmount
|
||||||
fmt.Printf("Note that this is less than the requested amount of %s FIL\n", amount)
|
if err := withdrawn.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Successfully withdrew %s FIL\n", withdrawn)
|
||||||
|
if withdrawn != amount {
|
||||||
|
fmt.Printf("Note that this is less than the requested amount of %s FIL\n", amount)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -5,6 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
@ -138,14 +140,21 @@ var actorWithdrawCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var withdrawn abi.TokenAmount
|
nv, err := nodeAPI.StateNetworkVersion(ctx, wait.TipSet)
|
||||||
if err := withdrawn.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Successfully withdrew %s FIL\n", withdrawn)
|
if nv >= network.Version14 {
|
||||||
if withdrawn != amount {
|
var withdrawn abi.TokenAmount
|
||||||
fmt.Printf("Note that this is less than the requested amount of %s FIL\n", amount)
|
if err := withdrawn.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Successfully withdrew %s FIL\n", withdrawn)
|
||||||
|
if withdrawn != amount {
|
||||||
|
fmt.Printf("Note that this is less than the requested amount of %s FIL\n", amount)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user