diff --git a/changelog.d/9394.misc b/changelog.d/9394.misc
new file mode 100644
index 0000000000000000000000000000000000000000..b3e90143cc4cd29b82fb990c618a3ec6dbf021f2
--- /dev/null
+++ b/changelog.d/9394.misc
@@ -0,0 +1 @@
+Remove some dead code from the acceptance of room invites path.
\ No newline at end of file
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index eddc7582d0c5ef33a05f052c6fd6554d4425f64a..5581e06bb464b22f89d6a748171e3e89ad242832 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -1354,8 +1354,6 @@ class FederationHandler(BaseHandler):
 
         await self._clean_room_for_join(room_id)
 
-        handled_events = set()
-
         try:
             # Try the host we successfully got a response to /make_join/
             # request first.
@@ -1375,10 +1373,6 @@ class FederationHandler(BaseHandler):
             auth_chain = ret["auth_chain"]
             auth_chain.sort(key=lambda e: e.depth)
 
-            handled_events.update([s.event_id for s in state])
-            handled_events.update([a.event_id for a in auth_chain])
-            handled_events.add(event.event_id)
-
             logger.debug("do_invite_join auth_chain: %s", auth_chain)
             logger.debug("do_invite_join state: %s", state)