From 68c7beb977305d7ac98083aaf238ab1f8a7789d0 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 12 Aug 2021 16:39:18 +0100 Subject: [PATCH] Stop setting the outlier flag for things that aren't Marking things as outliers to inhibit pushes is a sledgehammer to crack a nut. Move the test further down the stack so that we just inhibit the thing we want. --- changelog.d/10614.misc | 1 + synapse/handlers/federation.py | 9 ++------- 2 files changed, 3 insertions(+), 7 deletions(-) create mode 100644 changelog.d/10614.misc diff --git a/changelog.d/10614.misc b/changelog.d/10614.misc new file mode 100644 index 000000000000..9a765435dbe4 --- /dev/null +++ b/changelog.d/10614.misc @@ -0,0 +1 @@ +Clean up some of the federation event authentication code for clarity. diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index c0e13bdaac1d..a257d87fedb6 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -293,13 +293,7 @@ async def on_receive_pdu( prevs = set(pdu.prev_event_ids()) seen = await self.store.have_events_in_timeline(prevs) - if min_depth is not None and pdu.depth < min_depth: - # This is so that we don't notify the user about this - # message, to work around the fact that some events will - # reference really really old events we really don't want to - # send to the clients. - pdu.internal_metadata.outlier = True - elif min_depth is not None and pdu.depth > min_depth: + if min_depth is not None and pdu.depth > min_depth: missing_prevs = prevs - seen if sent_to_us_directly and missing_prevs: # If we're missing stuff, ensure we only fetch stuff one @@ -2375,6 +2369,7 @@ async def _run_push_actions_and_persist_event( not event.internal_metadata.is_outlier() and not backfilled and not context.rejected + and (await self.store.get_min_depth(event.room_id)) <= event.depth ): await self.action_generator.handle_push_actions_for_event( event, context