summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2016-08-05 11:12:32 +0100
committerGitHub <noreply@github.com>2016-08-05 11:12:32 +0100
commit9377509dcd8f36a9d7318e014bc9ab057b13a68a (patch)
tree0f2ace6f5589102c4d94aa20d82d4e90622508a1 /synapse
parentMerge pull request #985 from matrix-org/erikj/fix_integrity_retry (diff)
parentFix typo (diff)
downloadsynapse-9377509dcd8f36a9d7318e014bc9ab057b13a68a.tar.xz
Merge pull request #986 from matrix-org/erikj/state
Check if we already have the events returned by /state/
Diffstat (limited to 'synapse')
-rw-r--r--synapse/federation/federation_client.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py
index 7e1690b0fb..65778fd4ee 100644
--- a/synapse/federation/federation_client.py
+++ b/synapse/federation/federation_client.py
@@ -361,12 +361,26 @@ class FederationClient(FederationBase):
             for p in result.get("auth_chain", [])
         ]
 
+        seen_events = yield self.store.get_events([
+            ev.event_id for ev in itertools.chain(pdus, auth_chain)
+        ])
+
         signed_pdus = yield self._check_sigs_and_hash_and_fetch(
-            destination, pdus, outlier=True
+            destination,
+            [p for p in pdus if p.event_id not in seen_events],
+            outlier=True
+        )
+        signed_pdus.extend(
+            seen_events[p.event_id] for p in pdus if p.event_id in seen_events
         )
 
         signed_auth = yield self._check_sigs_and_hash_and_fetch(
-            destination, auth_chain, outlier=True
+            destination,
+            [p for p in auth_chain if p.event_id not in seen_events],
+            outlier=True
+        )
+        signed_auth.extend(
+            seen_events[p.event_id] for p in auth_chain if p.event_id in seen_events
         )
 
         signed_auth.sort(key=lambda e: e.depth)