diff options
author | Erik Johnston <erikj@jki.re> | 2019-01-29 21:40:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-29 21:40:00 +0000 |
commit | 6f9cdc2d47239f6cb7596a2a875379287a8fe83a (patch) | |
tree | 0edf9ec31f152ef45541b16ff9ed4a3c68bac142 /synapse/events/builder.py | |
parent | Merge pull request #4512 from matrix-org/anoa/consent_dir (diff) | |
parent | Newsfile (diff) | |
download | synapse-6f9cdc2d47239f6cb7596a2a875379287a8fe83a.tar.xz |
Merge pull request #4483 from matrix-org/erikj/event_v2
Implement event format V2
Diffstat (limited to 'synapse/events/builder.py')
-rw-r--r-- | synapse/events/builder.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/synapse/events/builder.py b/synapse/events/builder.py index fb0683cea8..06e01be918 100644 --- a/synapse/events/builder.py +++ b/synapse/events/builder.py @@ -21,6 +21,7 @@ from synapse.api.constants import ( KNOWN_EVENT_FORMAT_VERSIONS, KNOWN_ROOM_VERSIONS, MAX_DEPTH, + EventFormatVersions, ) from synapse.crypto.event_signing import add_hashes_and_signatures from synapse.types import EventID @@ -109,8 +110,12 @@ class EventBuilder(object): self, state_ids, ) - auth_events = yield self._store.add_event_hashes(auth_ids) - prev_events = yield self._store.add_event_hashes(prev_event_ids) + if self.format_version == EventFormatVersions.V1: + auth_events = yield self._store.add_event_hashes(auth_ids) + prev_events = yield self._store.add_event_hashes(prev_event_ids) + else: + auth_events = auth_ids + prev_events = prev_event_ids old_depth = yield self._store.get_max_depth_of( prev_event_ids, @@ -228,7 +233,8 @@ def create_local_event_from_event_dict(clock, hostname, signing_key, time_now = int(clock.time_msec()) - event_dict["event_id"] = _create_event_id(clock, hostname) + if format_version == EventFormatVersions.V1: + event_dict["event_id"] = _create_event_id(clock, hostname) event_dict["origin"] = hostname event_dict["origin_server_ts"] = time_now |