From feecbf6ffbc7307ca0e2b40925eb5f6dc7862ce6 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 24 Feb 2022 10:40:36 +0000 Subject: [PATCH] Potentially reduce number of iterations in `isInAllAuthLists --- roomserver/state/state.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roomserver/state/state.go b/roomserver/state/state.go index fc12e4fbd..187b996cd 100644 --- a/roomserver/state/state.go +++ b/roomserver/state/state.go @@ -880,11 +880,12 @@ func (v *StateResolution) resolveConflictsV2( // This function works out if an event exists in all of the auth sets. isInAllAuthLists := func(event *gomatrixserverlib.Event) bool { - found := true for k := range authSets { - found = found && isInAuthList(k, event) + if !isInAuthList(k, event) { + return false + } } - return found + return true } // Look through all of the auth events that we've been given and work out if