Skip to content

Commit

Permalink
fix: calculation miner deposit
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Oct 15, 2024
1 parent 8f3035f commit 967f3a5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/submodule/chain/miner_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -792,9 +792,17 @@ func (msa *minerStateAPI) StateMinerPreCommitDepositForPower(ctx context.Context
return types.EmptyInt, fmt.Errorf("loading reward actor state: %w", err)
}

sectorWeight, err := msa.calculateSectorWeight(ctx, maddr, pci, ts.Height(), sTree)
if err != nil {
return types.EmptyInt, err
var sectorWeight abi.StoragePower
if msa.ChainSubmodule.Fork.GetNetworkVersion(ctx, ts.Height()) <= network.Version16 {
if sectorWeight, err = msa.calculateSectorWeight(ctx, maddr, pci, ts.Height(), sTree); err != nil {
return types.EmptyInt, err
}
} else {
ssize, err := pci.SealProof.SectorSize()
if err != nil {
return types.EmptyInt, fmt.Errorf("failed to resolve sector size for seal proof: %w", err)
}
sectorWeight = miner.QAPowerMax(ssize)
}

_, powerSmoothed, err := msa.pledgeCalculationInputs(ctx, sTree)
Expand Down

0 comments on commit 967f3a5

Please sign in to comment.