mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-24 07:13:09 -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) {
|
if len(u.removed) > len(u.added) {
|
||||||
// This really shouldn't happen.
|
// This really shouldn't happen.
|
||||||
// TODO: What is ultimately the best way to handle this situation?
|
// TODO: What is ultimately the best way to handle this situation?
|
||||||
return fmt.Errorf(
|
return &gomatrixserverlib.NotAllowed{
|
||||||
"invalid state delta wants to remove %d state but only add %d state (between state snapshots %d and %d)",
|
Message: fmt.Sprintf(
|
||||||
len(u.removed), len(u.added), u.oldStateNID, u.newStateNID,
|
"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
|
// Also work out the state before the event removes and the event
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue