sealing: numassign: take on-chain allocated numbers into account

This commit is contained in:
Łukasz Magiera
2022-08-22 16:55:44 -04:00
parent ef2080a800
commit 00bef607ca
12 changed files with 102 additions and 0 deletions
+12
View File
@@ -880,6 +880,18 @@ func (a *StateAPI) StateMinerSectorCount(ctx context.Context, addr address.Addre
return api.MinerSectors{Live: liveCount, Active: activeCount, Faulty: faultyCount}, nil
}
func (a *StateAPI) StateMinerAllocated(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*bitfield.BitField, error) {
act, err := a.StateManager.LoadActorTsk(ctx, addr, tsk)
if err != nil {
return nil, err
}
mas, err := miner.Load(a.Chain.ActorStore(ctx), act)
if err != nil {
return nil, err
}
return mas.GetAllocatedSectors()
}
func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*minertypes.SectorPreCommitOnChainInfo, error) {
ts, err := a.Chain.GetTipSetFromKey(ctx, tsk)
if err != nil {