Return no error but don't morph state

This commit is contained in:
Neil Alexander 2020-10-08 11:55:58 +01:00
parent f8cf9fe2d6
commit 501da453eb
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -236,12 +236,13 @@ func (u *latestEventsUpdater) latestState() error {
if len(u.removed) > len(u.added) {
// This really shouldn't happen.
// TODO: What is ultimately the best way to handle this situation?
return &gomatrixserverlib.NotAllowed{
Message: fmt.Sprintf(
"invalid state delta wants to remove %d state but only add %d state (between state snapshots %d and %d)",
len(u.removed), len(u.added), u.oldStateNID, u.newStateNID,
),
}
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]
return nil
}
// Also work out the state before the event removes and the event