summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-06-19 15:35:56 +0100
committerErik Johnston <erik@matrix.org>2015-06-19 15:35:56 +0100
commitc461482e1abe60f98aa4c33294948d45231796b7 (patch)
tree60cd15128ff7f2389038a1492beb68740d90af1e
parentPEP8 (diff)
downloadsynapse-c461482e1abe60f98aa4c33294948d45231796b7.tar.xz
Remove unnecessary store.have_events call
-rw-r--r--synapse/handlers/federation.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index b5d882fd65..c8baf90b4a 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -1066,14 +1066,24 @@ class FederationHandler(BaseHandler):
     @log_function
     def do_auth(self, origin, event, context, auth_events):
         # Check if we have all the auth events.
-        have_events = yield self.store.have_events(
-            [e_id for e_id, _ in event.auth_events]
-        )
-
+        current_state = set(e.event_id for e in auth_events.values())
         event_auth_events = set(e_id for e_id, _ in event.auth_events)
+
+        if event_auth_events - current_state:
+            have_events = yield self.store.have_events(
+                event_auth_events - current_state
+            )
+        else:
+            have_events = {}
+
+        have_events.update({
+            e.event_id: ""
+            for e in auth_events.values()
+        })
+
         seen_events = set(have_events.keys())
 
-        missing_auth = event_auth_events - seen_events
+        missing_auth = event_auth_events - seen_events - current_state
 
         if missing_auth:
             logger.info("Missing auth: %s", missing_auth)