mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-23 23:03:10 -06:00
Return a non-fatal error to the federation API on a state regression
This commit is contained in:
parent
3e12f6e9c2
commit
f8cf9fe2d6
|
|
@ -236,10 +236,12 @@ 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 fmt.Errorf(
|
||||
"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,
|
||||
)
|
||||
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,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
// Also work out the state before the event removes and the event
|
||||
|
|
|
|||
Loading…
Reference in a new issue