Handle create events better

This commit is contained in:
Neil Alexander 2022-01-21 11:26:26 +00:00
parent 61437d6e44
commit 4253eccfb3
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 3 additions and 5 deletions

View file

@ -150,11 +150,9 @@ func (r *Queryer) QueryMissingAuthPrevEvents(
for _, prevEventID := range request.PrevEventIDs {
if state, err := r.DB.StateAtEventIDs(ctx, []string{prevEventID}); err != nil || len(state) == 0 {
if state[0].EventTypeNID != types.MRoomCreateNID {
response.MissingPrevEventIDs = append(response.MissingPrevEventIDs, prevEventID)
}
}
}
return nil
}

View file

@ -311,7 +311,7 @@ func (s *eventStatements) BulkSelectStateAtEventByID(
); err != nil {
return nil, err
}
if result.BeforeStateSnapshotNID == 0 {
if result.BeforeStateSnapshotNID == 0 && result.EventTypeNID != types.MRoomCreateNID {
return nil, types.MissingEventError(
fmt.Sprintf("storage: missing state for event NID %d", result.EventNID),
)

View file

@ -322,7 +322,7 @@ func (s *eventStatements) BulkSelectStateAtEventByID(
); err != nil {
return nil, err
}
if result.BeforeStateSnapshotNID == 0 {
if result.BeforeStateSnapshotNID == 0 && result.EventTypeNID != types.MRoomCreateNID {
return nil, types.MissingEventError(
fmt.Sprintf("storage: missing state for event NID %d", result.EventNID),
)