Skip to content

Commit

Permalink
fix: command state power if power of miner not exist (#5110)
Browse files Browse the repository at this point in the history
  • Loading branch information
zl03jsj authored Jul 20, 2022
1 parent 0eb50c5 commit 8918e34
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ var statePowerCmd = &cmds.Command{
tp := power.TotalPower
if len(req.Arguments) == 1 {
mp := power.MinerPower
if !power.HasMinPower {
mp.QualityAdjPower = big.NewInt(0)
}
percI := big.Div(big.Mul(mp.QualityAdjPower, big.NewInt(1000000)), tp.QualityAdjPower)
writer.Printf("%s(%s) / %s(%s) ~= %0.4f%"+
"%\n", mp.QualityAdjPower.String(), types.SizeStr(mp.QualityAdjPower), tp.QualityAdjPower.String(), types.SizeStr(tp.QualityAdjPower), float64(percI.Int64())/10000)
Expand Down

0 comments on commit 8918e34

Please sign in to comment.