From 6c3c621de09a62c7ec8d89b2d8e6a9d73833fd0b Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 20 Oct 2020 12:36:16 +0100 Subject: [PATCH] Remove invalid state delta check (#1550) --- roomserver/internal/input/input_latest_events.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/roomserver/internal/input/input_latest_events.go b/roomserver/internal/input/input_latest_events.go index f76b0a0b..5631959b 100644 --- a/roomserver/internal/input/input_latest_events.go +++ b/roomserver/internal/input/input_latest_events.go @@ -233,18 +233,6 @@ func (u *latestEventsUpdater) latestState() error { if err != nil { return fmt.Errorf("roomState.DifferenceBetweenStateSnapshots: %w", err) } - if !u.stateAtEvent.Overwrite && len(u.removed) > len(u.added) { - // This really shouldn't happen. - // TODO: What is ultimately the best way to handle this situation? - logrus.Errorf( - "Invalid state delta on event %q wants to remove %d state but only add %d state (between state snapshots %d and %d)", - u.event.EventID(), len(u.removed), len(u.added), u.oldStateNID, u.newStateNID, - ) - u.added = u.added[:0] - u.removed = u.removed[:0] - u.newStateNID = u.oldStateNID - return nil - } // Also work out the state before the event removes and the event // adds.