native: drop OnPersistEnd

Now that PostPersist is being run for every native contract we can do our
dirty caching tricks right there instead of OnPersistEnd.
This commit is contained in:
Roman Khimov 2020-12-13 23:30:21 +03:00
parent 938be298f0
commit cb5ecaefe7
9 changed files with 21 additions and 64 deletions

View file

@ -102,16 +102,11 @@ func (s *Designate) OnPersist(ic *interop.Context) error {
// PostPersist implements Contract interface.
func (s *Designate) PostPersist(ic *interop.Context) error {
return nil
}
// OnPersistEnd updates cached values if they've been changed.
func (s *Designate) OnPersistEnd(d dao.DAO) error {
if !s.rolesChanged() {
return nil
}
nodeKeys, height, err := s.GetDesignatedByRole(d, RoleOracle, math.MaxUint32)
nodeKeys, height, err := s.GetDesignatedByRole(ic.DAO, RoleOracle, math.MaxUint32)
if err != nil {
return err
}