StateAPI: account for slashing in StateMinerPower

This commit is contained in:
Łukasz Magiera
2019-11-15 02:01:53 +01:00
parent ff94e7680d
commit 5381d10fe3
3 changed files with 19 additions and 1 deletions
+8
View File
@@ -52,6 +52,14 @@ func (a *StateAPI) StateMinerPower(ctx context.Context, maddr address.Address, t
return api.MinerPower{}, err
}
slashed, err := stmgr.GetMinerSlashed(ctx, a.StateManager, ts, maddr)
if err != nil {
return api.MinerPower{}, err
}
if slashed != 0 {
mpow = types.NewInt(0)
}
return api.MinerPower{
MinerPower: mpow,
TotalPower: tpow,