From adf2726f2053a4ef02cc4fcdbc00ac444a324eb1 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 6 Mar 2020 13:41:59 +0000 Subject: [PATCH] Fully populate eventIDMap --- roomserver/state/state.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/roomserver/state/state.go b/roomserver/state/state.go index d5dfb8bfc..b33ffe846 100644 --- a/roomserver/state/state.go +++ b/roomserver/state/state.go @@ -695,17 +695,25 @@ func (v StateResolution) resolveConflictsV2( notConflicted, conflicted []types.StateEntry, ) ([]types.StateEntry, error) { - // Load the non-conflicted events - nonConflictedEvents, _, err := v.loadStateEvents(ctx, notConflicted) + var eventIDMap map[string]StateEntry + + // Load the conflicted events + conflictedEvents, conflictedEventMap, err := v.loadStateEvents(ctx, conflicted) if err != nil { return nil, err } + for k, v := range conflictedEventMap { + eventIDMap[k] = v + } - // Load the conflicted events - conflictedEvents, eventIDMap, err := v.loadStateEvents(ctx, conflicted) + // Load the non-conflicted events + nonConflictedEvents, nonConflictedEventMap, err := v.loadStateEvents(ctx, notConflicted) if err != nil { return nil, err } + for k, v := range nonConflictedEventMap { + eventIDMap[k] = v + } // For each conflicted event, we will add a new set of auth events. Auth // events may be duplicated across these sets but that's OK.