Merge pull request #8336 from filecoin-project/fix/snap-list-estimate

fix: miner cli: Estimate deal weight in sector list when upgrading
This commit is contained in:
Łukasz Magiera 2022-03-17 17:30:41 +01:00 committed by GitHub
commit b26405226e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 1 deletions

View File

@ -433,7 +433,7 @@ var sectorsListCmd = &cli.Command{
const verifiedPowerGainMul = 9
dw, vp := .0, .0
estimate := st.Expiration-st.Activation <= 0
estimate := (st.Expiration-st.Activation <= 0) || sealing.IsUpgradeState(sealing.SectorState(st.State))
if !estimate {
rdw := big.Add(st.DealWeight, st.VerifiedDealWeight)
dw = float64(big.Div(rdw, big.NewInt(int64(st.Expiration-st.Activation))).Uint64())

View File

@ -169,3 +169,25 @@ func toStatState(st SectorState, finEarly bool) statSectorState {
return sstFailed
}
func IsUpgradeState(st SectorState) bool {
switch st {
case SnapDealsWaitDeals,
SnapDealsAddPiece,
SnapDealsPacking,
UpdateReplica,
ProveReplicaUpdate,
SubmitReplicaUpdate,
SnapDealsAddPieceFailed,
SnapDealsDealsExpired,
SnapDealsRecoverDealIDs,
AbortUpgrade,
ReplicaUpdateFailed,
ReleaseSectorKeyFailed,
FinalizeReplicaUpdateFailed:
return true
default:
return false
}
}