diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-02-10 10:05:14 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-10 10:05:14 +0000 |
commit | 2782ae3d5635de4eaa4b8b4ca5b1a289745ba554 (patch) | |
tree | 83371bab910e166352cd947a70e3ffd6152ba265 /roomserver/internal/query | |
parent | 9130156b131ec5a1714f4a7f6e54f12657d655a1 (diff) |
Fix fetching missing state (#2163)
* Check that we have a populated state snapshot when determining if we closed the gap
* Do the same in the query API
* Use HasState more opportunistically
* Try to avoid falling down the hole of using a trustworthy but empty state snapshot for non-create events
* Refactor missing state and make sure that we really solve the problem for the new event
* Comments
* Review comments
* Tweak that check again
* Tidy up that create check further
* Fix build hopefully
* Update sendOutliers to use OrderAuthAndStateEvents
* Don't go out of bounds on missingEvents
Diffstat (limited to 'roomserver/internal/query')
-rw-r--r-- | roomserver/internal/query/query.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/roomserver/internal/query/query.go b/roomserver/internal/query/query.go index 84553303..05cd686f 100644 --- a/roomserver/internal/query/query.go +++ b/roomserver/internal/query/query.go @@ -150,7 +150,7 @@ func (r *Queryer) QueryMissingAuthPrevEvents( for _, prevEventID := range request.PrevEventIDs { state, err := r.DB.StateAtEventIDs(ctx, []string{prevEventID}) - if err != nil || len(state) == 0 { + if err != nil || len(state) == 0 || (!state[0].IsCreate() && state[0].BeforeStateSnapshotNID == 0) { response.MissingPrevEventIDs = append(response.MissingPrevEventIDs, prevEventID) } } |