Merge pull request #887 from filecoin-project/feat/sector-size-cmd

add command to get sector size of a miner
This commit is contained in:
Łukasz Magiera 2019-12-12 12:56:08 +01:00 committed by GitHub
commit 5537cc3444
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 1 deletions

View File

@ -24,6 +24,7 @@ var stateCmd = &cli.Command{
stateGetActorCmd,
stateLookupIDCmd,
stateReplaySetCmd,
stateSectorSizeCmd,
},
}
@ -334,3 +335,35 @@ var stateLookupIDCmd = &cli.Command{
return nil
},
}
var stateSectorSizeCmd = &cli.Command{
Name: "sector-size",
Usage: "Look up miners sector size",
Action: func(cctx *cli.Context) error {
api, closer, err := GetFullNodeAPI(cctx)
if err != nil {
return err
}
defer closer()
ctx := ReqContext(cctx)
if !cctx.Args().Present() {
return fmt.Errorf("must pass address of actor to get")
}
addr, err := address.NewFromString(cctx.Args().First())
if err != nil {
return err
}
ssize, err := api.StateMinerSectorSize(ctx, addr, nil)
if err != nil {
return err
}
fmt.Printf("%d\n", ssize)
return nil
},
}

View File

@ -270,7 +270,7 @@ func (m *Miner) mineOne(ctx context.Context, addr address.Address, base *MiningB
return nil, nil
}
log.Infof("Time delta between now and our mining base: %ds", uint64(time.Now().Unix())-base.ts.MinTimestamp())
log.Infof("Time delta between now and our mining base: %ds (nulls: %d)", uint64(time.Now().Unix())-base.ts.MinTimestamp(), base.nullRounds)
ticket, err := m.computeTicket(ctx, addr, base)
if err != nil {