override maddr for observability

This commit is contained in:
Anton Evangelatov 2020-07-02 18:48:39 +02:00
parent 3aaa4fb692
commit 2a050ca326
2 changed files with 32 additions and 0 deletions

View File

@ -62,6 +62,10 @@ func main() {
Version: build.UserVersion(),
EnableBashCompletion: true,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "maddr",
Value: "",
},
&cli.StringFlag{
Name: "repo",
EnvVars: []string{"LOTUS_PATH"},

View File

@ -10,6 +10,7 @@ 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"
@ -53,6 +54,15 @@ var provingFaultsCmd = &cli.Command{
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)
}
}
var mas miner.State
{
mact, err := api.StateGetActor(ctx, maddr, types.EmptyTSK)
@ -121,6 +131,15 @@ var provingInfoCmd = &cli.Command{
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)
}
}
head, err := api.ChainHead(ctx)
if err != nil {
return xerrors.Errorf("getting chain head: %w", err)
@ -244,6 +263,15 @@ var provingDeadlinesCmd = &cli.Command{
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)
}
}
deadlines, err := api.StateMinerDeadlines(ctx, maddr, types.EmptyTSK)
if err != nil {
return xerrors.Errorf("getting deadlines: %w", err)