From f98c6910118d1140e4fb325ee11a411fae910cee Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 14 Jul 2022 17:22:17 +0100 Subject: [PATCH] Fix bug where the state deltas were incorrect --- synapse/state/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/synapse/state/__init__.py b/synapse/state/__init__.py index 9f0a36652c25..91c41d8ec4b9 100644 --- a/synapse/state/__init__.py +++ b/synapse/state/__init__.py @@ -769,6 +769,11 @@ def _make_state_cache_entry( delta_ids: Optional[StateMap[str]] = None for old_group, old_state in state_groups_ids.items(): + if old_state.keys() - new_state.keys(): + # Currently we don't support deltas that remove keys from the state + # map. + continue + n_delta_ids = {k: v for k, v in new_state.items() if old_state.get(k) != v} if not delta_ids or len(n_delta_ids) < len(delta_ids): prev_group = old_group