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
if vmctx.BlockHeight() > build.ForkMissingSnowballs {
self.Power = types.NewInt(0) self.Power = types.NewInt(0)
}
nstate, err := vmctx.Storage().Put(self) nstate, err := vmctx.Storage().Put(self)
if err != nil { if err != nil {
@ -729,6 +732,7 @@ 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")
} }
if vmctx.BlockHeight() > build.ForkMissingSnowballs {
oldstate, self, err := loadState(vmctx) oldstate, self, err := loadState(vmctx)
if err != nil { if err != nil {
return nil, aerrors.Wrap(err, "failed to load state for slashing") return nil, aerrors.Wrap(err, "failed to load state for slashing")
@ -743,6 +747,7 @@ func (sma StorageMinerActor2) SlashConsensusFault(act *types.Actor, vmctx types.
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,
// their users could potentially be unaffected, but the miner will never be // their users could potentially be unaffected, but the miner will never be