diff options
author | Erik Johnston <erik@matrix.org> | 2017-03-29 10:56:26 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-03-29 10:56:26 +0100 |
commit | ac6bc5551204467e30d6544bd9ab520b71695687 (patch) | |
tree | ca6f19a1c34f5a476bb0187a9241492e1e4908c0 /synapse/storage | |
parent | The algorithm is part of the key id (diff) | |
download | synapse-ac6bc5551204467e30d6544bd9ab520b71695687.tar.xz |
Correctly look up key
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/end_to_end_keys.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/synapse/storage/end_to_end_keys.py b/synapse/storage/end_to_end_keys.py index b746f74269..c4020869f4 100644 --- a/synapse/storage/end_to_end_keys.py +++ b/synapse/storage/end_to_end_keys.py @@ -149,12 +149,11 @@ class EndToEndKeyStore(SQLBaseStore): new_keys = [] # Keys that we need to insert for algorithm, key_id, json_bytes in key_list: - if (algorithm, key_id) in existing_key_map: - ex_bytes = existing_key_map[key_id] - if json_bytes != ex_bytes: - raise SynapseError( - 400, "One time key with key_id %r already exists" % (key_id,) - ) + ex_bytes = existing_key_map.get((algorithm, key_id), None) + if ex_bytes and json_bytes != ex_bytes: + raise SynapseError( + 400, "One time key with key_id %r already exists" % (key_id,) + ) else: new_keys.append((algorithm, key_id, json_bytes)) |