Merge branch 'next' into refactor/lib/blockstore
This commit is contained in:
@@ -72,6 +72,11 @@ type SealingConfig struct {
|
||||
WaitDealsDelay Duration
|
||||
|
||||
AlwaysKeepUnsealedCopy bool
|
||||
|
||||
// Keep this many sectors in sealing pipeline, start CC if needed
|
||||
// todo TargetSealingSectors uint64
|
||||
|
||||
// todo TargetSectors - stop auto-pleding new sectors after this many sectors are sealed, default CC upgrade for deals sectors if above
|
||||
}
|
||||
|
||||
type MinerFeeConfig struct {
|
||||
|
||||
@@ -1097,9 +1097,9 @@ func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr
|
||||
|
||||
var sectorWeight abi.StoragePower
|
||||
if act, err := state.GetActor(market.Address); err != nil {
|
||||
return types.EmptyInt, xerrors.Errorf("loading miner actor %s: %w", maddr, err)
|
||||
return types.EmptyInt, xerrors.Errorf("loading market actor: %w", err)
|
||||
} else if s, err := market.Load(store, act); err != nil {
|
||||
return types.EmptyInt, xerrors.Errorf("loading market actor state %s: %w", maddr, err)
|
||||
return types.EmptyInt, xerrors.Errorf("loading market actor state: %w", err)
|
||||
} else if w, vw, err := s.VerifyDealsForActivation(maddr, pci.DealIDs, ts.Height(), pci.Expiration); err != nil {
|
||||
return types.EmptyInt, xerrors.Errorf("verifying deals for activation: %w", err)
|
||||
} else {
|
||||
@@ -1113,7 +1113,7 @@ func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr
|
||||
pledgeCollateral abi.TokenAmount
|
||||
)
|
||||
if act, err := state.GetActor(power.Address); err != nil {
|
||||
return types.EmptyInt, xerrors.Errorf("loading miner actor: %w", err)
|
||||
return types.EmptyInt, xerrors.Errorf("loading power actor: %w", err)
|
||||
} else if s, err := power.Load(store, act); err != nil {
|
||||
return types.EmptyInt, xerrors.Errorf("loading power actor state: %w", err)
|
||||
} else if p, err := s.TotalPowerSmoothed(); err != nil {
|
||||
@@ -1127,7 +1127,7 @@ func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr
|
||||
|
||||
rewardActor, err := state.GetActor(reward.Address)
|
||||
if err != nil {
|
||||
return types.EmptyInt, xerrors.Errorf("loading miner actor: %w", err)
|
||||
return types.EmptyInt, xerrors.Errorf("loading reward actor: %w", err)
|
||||
}
|
||||
|
||||
rewardState, err := reward.Load(store, rewardActor)
|
||||
|
||||
+28
-2
@@ -121,8 +121,30 @@ func (sm *StorageMinerAPI) ActorSectorSize(ctx context.Context, addr address.Add
|
||||
return mi.SectorSize, nil
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) PledgeSector(ctx context.Context) error {
|
||||
return sm.Miner.PledgeSector()
|
||||
func (sm *StorageMinerAPI) PledgeSector(ctx context.Context) (abi.SectorID, error) {
|
||||
sr, err := sm.Miner.PledgeSector(ctx)
|
||||
if err != nil {
|
||||
return abi.SectorID{}, err
|
||||
}
|
||||
|
||||
// wait for the sector to enter the Packing state
|
||||
// TODO: instead of polling implement some pubsub-type thing in storagefsm
|
||||
for {
|
||||
info, err := sm.Miner.GetSectorInfo(sr.ID.Number)
|
||||
if err != nil {
|
||||
return abi.SectorID{}, xerrors.Errorf("getting pledged sector info: %w", err)
|
||||
}
|
||||
|
||||
if info.State != sealing.UndefinedSectorState {
|
||||
return sr.ID, nil
|
||||
}
|
||||
|
||||
select {
|
||||
case <-time.After(10 * time.Millisecond):
|
||||
case <-ctx.Done():
|
||||
return abi.SectorID{}, ctx.Err()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid abi.SectorNumber, showOnChainInfo bool) (api.SectorInfo, error) {
|
||||
@@ -219,6 +241,10 @@ func (sm *StorageMinerAPI) SectorsList(context.Context) ([]abi.SectorNumber, err
|
||||
|
||||
out := make([]abi.SectorNumber, len(sectors))
|
||||
for i, sector := range sectors {
|
||||
if sector.State == sealing.UndefinedSectorState {
|
||||
continue // sector ID not set yet
|
||||
}
|
||||
|
||||
out[i] = sector.SectorNumber
|
||||
}
|
||||
return out, nil
|
||||
|
||||
Reference in New Issue
Block a user