summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-09-13 15:03:22 +0100
committerErik Johnston <erik@matrix.org>2021-09-13 15:03:22 +0100
commit6ec29fa2a7e5e9486c179dd451c8ca2ca3dbbfc7 (patch)
tree13f6aae937c4b5f38377189b1fa6a47b5bc660bf
parentDon't store event edges for outliers (diff)
downloadsynapse-6ec29fa2a7e5e9486c179dd451c8ca2ca3dbbfc7.tar.xz
Don't add reference hashes to non-v1 events
-rw-r--r--synapse/storage/databases/main/events.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py
index 2c5b9e3c3c..c5a233f896 100644
--- a/synapse/storage/databases/main/events.py
+++ b/synapse/storage/databases/main/events.py
@@ -33,7 +33,7 @@ from prometheus_client import Counter
 
 import synapse.metrics
 from synapse.api.constants import EventContentFields, EventTypes, RelationTypes
-from synapse.api.room_versions import RoomVersions
+from synapse.api.room_versions import EventFormatVersions, RoomVersions
 from synapse.crypto.event_signing import compute_event_reference_hash
 from synapse.events import EventBase  # noqa: F401
 from synapse.events.snapshot import EventContext  # noqa: F401
@@ -1451,7 +1451,11 @@ class PersistEventsStore:
         return [ec for ec in events_and_contexts if ec[0] not in to_remove]
 
     def _update_metadata_tables_txn(
-        self, txn, events_and_contexts, all_events_and_contexts, backfilled
+        self,
+        txn,
+        events_and_contexts: List[Tuple[EventBase, EventContext]],
+        all_events_and_contexts,
+        backfilled,
     ):
         """Update all the miscellaneous tables for new events
 
@@ -1542,7 +1546,12 @@ class PersistEventsStore:
 
         # Insert event_reference_hashes table.
         self._store_event_reference_hashes_txn(
-            txn, [event for event, _ in events_and_contexts]
+            txn,
+            [
+                event
+                for event, _ in events_and_contexts
+                if event.format_version == EventFormatVersions.V1
+            ],
         )
 
         # Prefill the event cache