Get FilMined from the reward actor's state, not balance
This commit is contained in:
parent
165bcc1e38
commit
b6b5a79833
@ -914,16 +914,17 @@ func (sm *StateManager) GetFilVested(ctx context.Context, height abi.ChainEpoch,
|
||||
}
|
||||
|
||||
func GetFilMined(ctx context.Context, st *state.StateTree) (abi.TokenAmount, error) {
|
||||
rew, err := st.GetActor(builtin.RewardActorAddr)
|
||||
ractor, err := st.GetActor(builtin.RewardActorAddr)
|
||||
if err != nil {
|
||||
return big.Zero(), xerrors.Errorf("failed to load reward actor state: %w", err)
|
||||
}
|
||||
|
||||
fm := types.BigSub(types.FromFil(build.FilAllocStorageMining), rew.Balance)
|
||||
if fm.LessThan(big.Zero()) {
|
||||
fm = big.Zero()
|
||||
var rst reward.State
|
||||
if err := st.Store.Get(ctx, ractor.Head, &rst); err != nil {
|
||||
return big.Zero(), xerrors.Errorf("failed to load reward state: %w", err)
|
||||
}
|
||||
return fm, nil
|
||||
|
||||
return rst.TotalMined, nil
|
||||
}
|
||||
|
||||
func getFilMarketLocked(ctx context.Context, st *state.StateTree) (abi.TokenAmount, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user