compare state equivalence instead of using bool flag

This commit is contained in:
William Banfield
2022-05-19 12:17:45 -04:00
parent 02230b7683
commit b4ef3050aa

View File

@@ -255,6 +255,15 @@ func (cs *State) updateStateFromStore() error {
return nil
}
eq, err := state.Equals(cs.state)
if err != nil {
return fmt.Errorf("comparing state: %w", err)
}
// if the new state is equivalent to the old state, we should not trigger a state update.
if eq {
return nil
}
// We have no votes, so reconstruct LastCommit from SeenCommit.
if state.LastBlockHeight > 0 {
cs.reconstructLastCommit(state)