From b4ef3050aa888e12666aae5dc5f3f1205a3d2b0d Mon Sep 17 00:00:00 2001 From: William Banfield Date: Thu, 19 May 2022 12:17:45 -0400 Subject: [PATCH] compare state equivalence instead of using bool flag --- internal/consensus/state.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/consensus/state.go b/internal/consensus/state.go index 83a760287..320042d30 100644 --- a/internal/consensus/state.go +++ b/internal/consensus/state.go @@ -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)