put miner changes behind a fork switch

This commit is contained in:
whyrusleeping 2020-01-30 17:36:33 -08:00
parent c6fd45727d
commit 0622eb7634

View File

@ -633,7 +633,10 @@ func (sma StorageMinerActor2) CheckMiner(act *types.Actor, vmctx types.VMContext
self.SlashedAt = vmctx.BlockHeight() self.SlashedAt = vmctx.BlockHeight()
oldPower := self.Power oldPower := self.Power
self.Power = types.NewInt(0)
if vmctx.BlockHeight() > build.ForkMissingSnowballs {
self.Power = types.NewInt(0)
}
nstate, err := vmctx.Storage().Put(self) nstate, err := vmctx.Storage().Put(self)
if err != nil { if err != nil {
@ -729,19 +732,21 @@ func (sma StorageMinerActor2) SlashConsensusFault(act *types.Actor, vmctx types.
return nil, aerrors.Wrap(err, "failed to burn funds") return nil, aerrors.Wrap(err, "failed to burn funds")
} }
oldstate, self, err := loadState(vmctx) if vmctx.BlockHeight() > build.ForkMissingSnowballs {
if err != nil { oldstate, self, err := loadState(vmctx)
return nil, aerrors.Wrap(err, "failed to load state for slashing") if err != nil {
} return nil, aerrors.Wrap(err, "failed to load state for slashing")
}
self.Power = types.NewInt(0) self.Power = types.NewInt(0)
ncid, err := vmctx.Storage().Put(self) ncid, err := vmctx.Storage().Put(self)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := vmctx.Storage().Commit(oldstate, ncid); err != nil { if err := vmctx.Storage().Commit(oldstate, ncid); err != nil {
return nil, err return nil, err
}
} }
// TODO: this still allows the miner to commit sectors and submit posts, // TODO: this still allows the miner to commit sectors and submit posts,