polish: add ClaimsChanged method to power shim
This commit is contained in:
parent
704bef5dfc
commit
e33cc5ee12
@ -56,6 +56,7 @@ type State interface {
|
|||||||
MinerNominalPowerMeetsConsensusMinimum(address.Address) (bool, error)
|
MinerNominalPowerMeetsConsensusMinimum(address.Address) (bool, error)
|
||||||
ListAllMiners() ([]address.Address, error)
|
ListAllMiners() ([]address.Address, error)
|
||||||
ForEachClaim(func(miner address.Address, claim Claim) error) error
|
ForEachClaim(func(miner address.Address, claim Claim) error) error
|
||||||
|
ClaimsChanged(State) (bool, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Claim struct {
|
type Claim struct {
|
||||||
|
@ -115,3 +115,12 @@ func (s *state0) ForEachClaim(cb func(miner address.Address, claim Claim) error)
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *state0) ClaimsChanged(other State) (bool, error) {
|
||||||
|
other0, ok := other.(*state0)
|
||||||
|
if !ok {
|
||||||
|
// treat an upgrade as a change, always
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return !s.State.Claims.Equals(other0.State.Claims), nil
|
||||||
|
}
|
||||||
|
@ -115,3 +115,12 @@ func (s *state2) ForEachClaim(cb func(miner address.Address, claim Claim) error)
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *state2) ClaimsChanged(other State) (bool, error) {
|
||||||
|
other2, ok := other.(*state2)
|
||||||
|
if !ok {
|
||||||
|
// treat an upgrade as a change, always
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
return !s.State.Claims.Equals(other2.State.Claims), nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user