override maddr on lotus-storage-miner info
as well
This commit is contained in:
parent
2a050ca326
commit
978ab67c73
@ -44,7 +44,7 @@ var infoCmd = &cli.Command{
|
||||
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
maddr, err := nodeApi.ActorAddress(ctx)
|
||||
maddr, err := getActorAddress(ctx, nodeApi, cctx.String("maddr"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -1,12 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
"github.com/urfave/cli/v2"
|
||||
"go.opencensus.io/trace"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
"github.com/filecoin-project/lotus/lib/lotuslog"
|
||||
@ -89,3 +93,19 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func getActorAddress(ctx context.Context, nodeApi api.StorageMiner, overrideMaddr string) (maddr address.Address, err error) {
|
||||
if overrideMaddr != "" {
|
||||
maddr, err = address.NewFromString(overrideMaddr)
|
||||
if err != nil {
|
||||
return maddr, err
|
||||
}
|
||||
}
|
||||
|
||||
maddr, err = nodeApi.ActorAddress(ctx)
|
||||
if err != nil {
|
||||
return maddr, xerrors.Errorf("getting actor address: %w", err)
|
||||
}
|
||||
|
||||
return maddr, nil
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import (
|
||||
"github.com/urfave/cli/v2"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
@ -49,18 +48,9 @@ var provingFaultsCmd = &cli.Command{
|
||||
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
maddr, err := nodeApi.ActorAddress(ctx)
|
||||
maddr, err := getActorAddress(ctx, nodeApi, cctx.String("maddr"))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting actor address: %w", err)
|
||||
}
|
||||
|
||||
// override maddr is specified
|
||||
if cctx.String("maddr") != "" {
|
||||
var err error
|
||||
maddr, err = address.NewFromString(cctx.String("maddr"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
var mas miner.State
|
||||
@ -126,18 +116,9 @@ var provingInfoCmd = &cli.Command{
|
||||
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
maddr, err := nodeApi.ActorAddress(ctx)
|
||||
maddr, err := getActorAddress(ctx, nodeApi, cctx.String("maddr"))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting actor address: %w", err)
|
||||
}
|
||||
|
||||
// override maddr is specified
|
||||
if cctx.String("maddr") != "" {
|
||||
var err error
|
||||
maddr, err = address.NewFromString(cctx.String("maddr"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
head, err := api.ChainHead(ctx)
|
||||
@ -258,18 +239,9 @@ var provingDeadlinesCmd = &cli.Command{
|
||||
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
maddr, err := nodeApi.ActorAddress(ctx)
|
||||
maddr, err := getActorAddress(ctx, nodeApi, cctx.String("maddr"))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting actor address: %w", err)
|
||||
}
|
||||
|
||||
// override maddr is specified
|
||||
if cctx.String("maddr") != "" {
|
||||
var err error
|
||||
maddr, err = address.NewFromString(cctx.String("maddr"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
deadlines, err := api.StateMinerDeadlines(ctx, maddr, types.EmptyTSK)
|
||||
|
Loading…
Reference in New Issue
Block a user