Tweak StateMinerPreCommitDepositForPower based on network version
This commit is contained in:
parent
c0bbaebaf4
commit
76090193ea
@ -1186,16 +1186,20 @@ func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr
|
|||||||
store := a.Chain.ActorStore(ctx)
|
store := a.Chain.ActorStore(ctx)
|
||||||
|
|
||||||
var sectorWeight abi.StoragePower
|
var sectorWeight abi.StoragePower
|
||||||
if act, err := state.GetActor(market.Address); err != nil {
|
if a.StateManager.GetNetworkVersion(ctx, ts.Height()) <= network.Version16 {
|
||||||
return types.EmptyInt, xerrors.Errorf("loading market actor %s: %w", maddr, err)
|
if act, err := state.GetActor(market.Address); err != nil {
|
||||||
} else if s, err := market.Load(store, act); err != nil {
|
return types.EmptyInt, xerrors.Errorf("loading market actor %s: %w", maddr, err)
|
||||||
return types.EmptyInt, xerrors.Errorf("loading market actor state %s: %w", maddr, err)
|
} else if s, err := market.Load(store, act); err != nil {
|
||||||
} else if w, vw, err := s.VerifyDealsForActivation(maddr, pci.DealIDs, ts.Height(), pci.Expiration); err != nil {
|
return types.EmptyInt, xerrors.Errorf("loading market actor state %s: %w", maddr, err)
|
||||||
return types.EmptyInt, xerrors.Errorf("verifying deals for activation: %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 {
|
||||||
|
// NB: not exactly accurate, but should always lead us to *over* estimate, not under
|
||||||
|
duration := pci.Expiration - ts.Height()
|
||||||
|
sectorWeight = builtin.QAPowerForWeight(ssize, duration, w, vw)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// NB: not exactly accurate, but should always lead us to *over* estimate, not under
|
sectorWeight = minertypes.QAPowerMax(ssize)
|
||||||
duration := pci.Expiration - ts.Height()
|
|
||||||
sectorWeight = builtin.QAPowerForWeight(ssize, duration, w, vw)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var powerSmoothed builtin.FilterEstimate
|
var powerSmoothed builtin.FilterEstimate
|
||||||
|
Loading…
Reference in New Issue
Block a user