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,9 +150,7 @@ func (r *Queryer) QueryMissingAuthPrevEvents(
for _, prevEventID := range request.PrevEventIDs { for _, prevEventID := range request.PrevEventIDs {
if state, err := r.DB.StateAtEventIDs(ctx, []string{prevEventID}); err != nil || len(state) == 0 { 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)
response.MissingPrevEventIDs = append(response.MissingPrevEventIDs, prevEventID)
}
} }
} }

View file

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

View file

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