summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-01-27 09:49:15 +0000
committerRichard van der Hoff <richard@matrix.org>2018-02-05 16:23:25 +0000
commit9fcbbe8e7d7557fef7fe03533166b376d6fa82ef (patch)
tree539190b0275273110ae75c48e80b22d199927936 /synapse
parentAdd event_map param to resolve_state_groups (diff)
downloadsynapse-9fcbbe8e7d7557fef7fe03533166b376d6fa82ef.tar.xz
Check that events being persisted have state_group
Diffstat (limited to '')
-rw-r--r--synapse/storage/events.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 7b912ad413..9bceded7ba 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -515,16 +515,21 @@ class EventsStore(SQLBaseStore):
                     if ctx.current_state_ids is None:
                         raise Exception("Unknown current state")
 
+                    if ctx.state_group is None:
+                        # I don't think this can happen, but let's double-check
+                        raise Exception(
+                            "Context for new extremity event %s has no state "
+                            "group" % event_id,
+                        )
+
                     # If we've already seen the state group don't bother adding
                     # it to the state sets again
                     if ctx.state_group not in state_groups:
                         state_sets.append(ctx.current_state_ids)
                         if ctx.delta_ids or hasattr(ev, "state_key"):
                             was_updated = True
-                        if ctx.state_group:
-                            # Add this as a seen state group (if it has a state
-                            # group)
-                            state_groups.add(ctx.state_group)
+                        # Add this as a seen state group
+                        state_groups.add(ctx.state_group)
                     break
             else:
                 # If we couldn't find it, then we'll need to pull