Skip to content

Commit 8a40954

Browse files
eliminate an impossible error case from state.WriteState (#1473)
Signed-off-by: Tsachi Herman <24438559+tsachiherman@users.noreply.github.com> Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
1 parent f6f17a7 commit 8a40954

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

plugin/evm/validators/state/state.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,14 @@ func (s *state) WriteState() error {
197197
if err := batch.Delete(vID[:]); err != nil {
198198
return err
199199
}
200-
default:
201-
return fmt.Errorf("unknown update status for %s", vID)
202200
}
203-
// we're done, remove the updated marker
204-
delete(s.updatedData, vID)
205201
}
206-
return batch.Write()
202+
if err := batch.Write(); err != nil {
203+
return err
204+
}
205+
// we've successfully flushed the updates, clear the updated marker.
206+
clear(s.updatedData)
207+
return nil
207208
}
208209

209210
// SetStatus sets the active status of the validator with the given vID

0 commit comments

Comments
 (0)