mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 17:53:09 -06:00
Review comments
This commit is contained in:
parent
a38b3a3d1b
commit
1d6b620081
|
|
@ -255,20 +255,20 @@ func (r *Inputer) processRoomEvent(
|
|||
hadEvents: map[string]bool{},
|
||||
haveEvents: map[string]*gomatrixserverlib.HeaderedEvent{},
|
||||
}
|
||||
if override, err := missingState.processEventWithMissingState(ctx, event, headered.RoomVersion); err != nil {
|
||||
if stateSnapshot, err := missingState.processEventWithMissingState(ctx, event, headered.RoomVersion); err != nil {
|
||||
// Something went wrong with retrieving the missing state, so we can't
|
||||
// really do anything with the event other than reject it at this point.
|
||||
isRejected = true
|
||||
rejectionErr = fmt.Errorf("missingState.processEventWithMissingState: %w", err)
|
||||
} else if override != nil {
|
||||
} else if stateSnapshot != nil {
|
||||
// We retrieved some state and we ended up having to call /state_ids for
|
||||
// the new event in question (probably because closing the gap by using
|
||||
// /get_missing_events didn't do what we hoped) so we'll instead overwrite
|
||||
// the state snapshot with the newly resolved state.
|
||||
missingPrev = false
|
||||
input.HasState = true
|
||||
input.StateEventIDs = make([]string, 0, len(override.StateEvents))
|
||||
for _, e := range override.StateEvents {
|
||||
input.StateEventIDs = make([]string, 0, len(stateSnapshot.StateEvents))
|
||||
for _, e := range stateSnapshot.StateEvents {
|
||||
input.StateEventIDs = append(input.StateEventIDs, e.EventID())
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -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 || state[0].BeforeStateSnapshotNID == 0 {
|
||||
if err != nil || len(state) == 0 || (state[0].EventTypeNID != types.MRoomCreateNID && state[0].EventStateKeyNID == types.EmptyStateKeyNID && state[0].BeforeStateSnapshotNID == 0) {
|
||||
response.MissingPrevEventIDs = append(response.MissingPrevEventIDs, prevEventID)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue