better power show
This commit is contained in:
parent
e7a1be4dde
commit
709fd12b7f
@ -475,7 +475,8 @@ func powerLookup(ctx context.Context, vmctx types.VMContext, self *StoragePowerS
|
||||
}
|
||||
|
||||
if !has {
|
||||
return types.EmptyInt, aerrors.New(1, "miner not registered with storage power actor")
|
||||
// A miner could be registered with storage power actor, but removed for some reasons, e.g. consensus fault
|
||||
return types.EmptyInt, aerrors.New(1, "miner not registered with storage power actor, or removed already")
|
||||
}
|
||||
|
||||
// TODO: Use local amt
|
||||
|
@ -119,12 +119,15 @@ var statePowerCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
res := power.TotalPower
|
||||
tp := power.TotalPower
|
||||
if cctx.Args().Present() {
|
||||
res = power.MinerPower
|
||||
mp := power.MinerPower
|
||||
percI := types.BigDiv(types.BigMul(mp, types.NewInt(1000000)), tp)
|
||||
fmt.Printf("%s(%s) / %s(%s) ~= %0.4f%%\n", mp.String(), mp.SizeStr(), tp.String(), tp.SizeStr(), float64(percI.Int64())/10000)
|
||||
} else {
|
||||
fmt.Printf("%s(%s)\n", tp.String(), tp.SizeStr())
|
||||
}
|
||||
|
||||
fmt.Println(res.String())
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user