Tweak logic around checking missing state

This commit is contained in:
Neil Alexander 2022-01-21 09:55:13 +00:00
parent 848f5487f0
commit 078345a29d
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -166,8 +166,8 @@ func (r *Inputer) processRoomEvent(
} }
} }
missingPrev := false missingPrev := len(missingRes.MissingPrevEventIDs) > 0
if input.Kind != api.KindOutlier && len(missingRes.MissingPrevEventIDs) > 0 { if missingPrev && input.Kind != api.KindOutlier {
if len(serverRes.ServerNames) > 0 { if len(serverRes.ServerNames) > 0 {
missingState := missingStateReq{ missingState := missingStateReq{
origin: input.Origin, origin: input.Origin,
@ -183,12 +183,12 @@ func (r *Inputer) processRoomEvent(
} }
if err = missingState.processEventWithMissingState(ctx, input.Event.Unwrap(), input.Event.RoomVersion); err != nil { if err = missingState.processEventWithMissingState(ctx, input.Event.Unwrap(), input.Event.RoomVersion); err != nil {
isRejected = true isRejected = true
missingPrev = true
rejectionErr = fmt.Errorf("missingState.processEventWithMissingState: %w", err) rejectionErr = fmt.Errorf("missingState.processEventWithMissingState: %w", err)
} else {
missingPrev = false
} }
} else { } else {
isRejected = true isRejected = true
missingPrev = true
rejectionErr = fmt.Errorf("missing prev events and no other servers to ask") rejectionErr = fmt.Errorf("missing prev events and no other servers to ask")
} }
} }