From 5b38d555c46508fdcbcdd9a10d39a290e82de333 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 3 Apr 2020 18:11:05 +0100 Subject: [PATCH] Add comments to ResolveConflictsAdhoc --- roomserver/state/state.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roomserver/state/state.go b/roomserver/state/state.go index d0291a802..6427630c3 100644 --- a/roomserver/state/state.go +++ b/roomserver/state/state.go @@ -681,6 +681,12 @@ func (v StateResolution) calculateStateAfterManyEvents( return } +// ResolveConflictsAdhoc is a helper function to assist the query API in +// performing state resolution when requested. This is a different code +// path to the rest of state.go because this assumes you already have +// gomatrixserverlib.Event objects and not just a bunch of NIDs like +// elsewhere in the state resolution. +// TODO: Some of this can possibly be deduplicated func ResolveConflictsAdhoc( version gomatrixserverlib.RoomVersion, events []gomatrixserverlib.Event, @@ -720,6 +726,7 @@ func ResolveConflictsAdhoc( resolved = gomatrixserverlib.ResolveStateConflicts(conflicted, authEvents) resolved = append(resolved, notConflicted...) case gomatrixserverlib.StateResV2: + // TODO: auth difference here? resolved = gomatrixserverlib.ResolveStateConflictsV2(conflicted, notConflicted, authEvents, authEvents) default: return nil, errors.New("unsupported state resolution algorithm")