Remove network version panic
This commit is contained in:
@@ -561,7 +561,15 @@ var sectorsExtendCmd = &cli.Command{
|
||||
for l, exts := range extensions {
|
||||
for newExp, numbers := range exts {
|
||||
scount += len(numbers)
|
||||
if scount > policy.GetAddressedSectorsMax(nv) || len(p.Extensions) == policy.GetDeclarationsMax(nv) {
|
||||
addressedMax, err := policy.GetAddressedSectorsMax(nv)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to get addressed sectors max")
|
||||
}
|
||||
declMax, err := policy.GetDeclarationsMax(nv)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to get declarations max")
|
||||
}
|
||||
if scount > addressedMax || len(p.Extensions) == declMax {
|
||||
params = append(params, p)
|
||||
p = miner3.ExtendSectorExpirationParams{}
|
||||
scount = len(numbers)
|
||||
|
||||
@@ -271,7 +271,7 @@ func (bb *BlockBuilder) StateManager() *stmgr.StateManager {
|
||||
}
|
||||
|
||||
// ActorsVersion returns the actors version for the target block.
|
||||
func (bb *BlockBuilder) ActorsVersion() actors.Version {
|
||||
func (bb *BlockBuilder) ActorsVersion() (actors.Version, error) {
|
||||
return actors.VersionForNetwork(bb.NetworkVersion())
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,10 @@ func (fs *FundingStage) PackMessages(ctx context.Context, bb *blockbuilder.Block
|
||||
|
||||
store := bb.ActorStore()
|
||||
epoch := bb.Height()
|
||||
actorsVersion := bb.ActorsVersion()
|
||||
actorsVersion, err := bb.ActorsVersion()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var accounts, multisigs int
|
||||
defer func() {
|
||||
|
||||
@@ -280,7 +280,11 @@ func (stage *ProveCommitStage) packProveCommitsMiner(
|
||||
// It will drop any pre-commits that have already expired.
|
||||
func (stage *ProveCommitStage) loadMiner(ctx context.Context, bb *blockbuilder.BlockBuilder, addr address.Address) error {
|
||||
epoch := bb.Height()
|
||||
av := bb.ActorsVersion()
|
||||
av, err := bb.ActorsVersion()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
minerState, err := loadMiner(bb.ActorStore(), bb.ParentStateTree(), addr)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -291,7 +295,10 @@ func (stage *ProveCommitStage) loadMiner(ctx context.Context, bb *blockbuilder.B
|
||||
var total, dropped int
|
||||
err = minerState.ForEachPrecommittedSector(func(info miner.SectorPreCommitOnChainInfo) error {
|
||||
total++
|
||||
msd := policy.GetMaxProveCommitDuration(av, info.Info.SealProof)
|
||||
msd, err := policy.GetMaxProveCommitDuration(av, info.Info.SealProof)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if epoch > info.PreCommitEpoch+msd {
|
||||
dropped++
|
||||
return nil
|
||||
@@ -327,7 +334,10 @@ func (stage *ProveCommitStage) filterProveCommits(
|
||||
}
|
||||
|
||||
nextEpoch := bb.Height()
|
||||
av := bb.ActorsVersion()
|
||||
av, err := bb.ActorsVersion()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
good := make([]abi.SectorNumber, 0, len(snos))
|
||||
for _, sno := range snos {
|
||||
@@ -338,7 +348,10 @@ func (stage *ProveCommitStage) filterProveCommits(
|
||||
if info == nil {
|
||||
continue
|
||||
}
|
||||
msd := policy.GetMaxProveCommitDuration(av, info.Info.SealProof)
|
||||
msd, err := policy.GetMaxProveCommitDuration(av, info.Info.SealProof)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if nextEpoch > info.PreCommitEpoch+msd {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user