mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 03:43:11 -06:00
Clamp min depth to 0
This commit is contained in:
parent
21f8842395
commit
bc1d8772dc
|
|
@ -561,10 +561,14 @@ func (t *txnReq) getMissingEvents(e gomatrixserverlib.Event, roomVersion gomatri
|
||||||
latestEvents[i] = res.LatestEvents[i].EventID
|
latestEvents[i] = res.LatestEvents[i].EventID
|
||||||
}
|
}
|
||||||
// this server just sent us an event for which we do not know its prev_events - ask that server for those prev_events.
|
// this server just sent us an event for which we do not know its prev_events - ask that server for those prev_events.
|
||||||
|
minDepth := int(res.Depth) - 20
|
||||||
|
if minDepth < 0 {
|
||||||
|
minDepth = 0
|
||||||
|
}
|
||||||
missingResp, err := t.federation.LookupMissingEvents(t.context, t.Origin, e.RoomID(), gomatrixserverlib.MissingEvents{
|
missingResp, err := t.federation.LookupMissingEvents(t.context, t.Origin, e.RoomID(), gomatrixserverlib.MissingEvents{
|
||||||
Limit: 20,
|
Limit: 20,
|
||||||
// synapse uses the min depth they've ever seen in that room
|
// synapse uses the min depth they've ever seen in that room
|
||||||
MinDepth: int(res.Depth) - 20,
|
MinDepth: minDepth,
|
||||||
// The latest event IDs that the sender already has. These are skipped when retrieving the previous events of latest_events.
|
// The latest event IDs that the sender already has. These are skipped when retrieving the previous events of latest_events.
|
||||||
EarliestEvents: latestEvents,
|
EarliestEvents: latestEvents,
|
||||||
// The event IDs to retrieve the previous events for.
|
// The event IDs to retrieve the previous events for.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue