From 2a050ca3267e00609ee414cacfab237a84838ca4 Mon Sep 17 00:00:00 2001 From: Anton Evangelatov Date: Thu, 2 Jul 2020 18:48:39 +0200 Subject: [PATCH] override maddr for observability --- cmd/lotus-storage-miner/main.go | 4 ++++ cmd/lotus-storage-miner/proving.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/cmd/lotus-storage-miner/main.go b/cmd/lotus-storage-miner/main.go index 62efe9370..bc8d3418a 100644 --- a/cmd/lotus-storage-miner/main.go +++ b/cmd/lotus-storage-miner/main.go @@ -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"}, diff --git a/cmd/lotus-storage-miner/proving.go b/cmd/lotus-storage-miner/proving.go index d96bd39f8..352336505 100644 --- a/cmd/lotus-storage-miner/proving.go +++ b/cmd/lotus-storage-miner/proving.go @@ -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)