summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-10-17 16:50:04 +0100
committerMark Haines <mark.haines@matrix.org>2014-10-17 16:50:04 +0100
commitc5cec1cc77029c21f0117c318c522ab320de3923 (patch)
treee7d3a36d1db4935f306f4354bed59bfc92ea2828 /synapse
parentmove 'age' into 'meta' subdict so that it is clearer that it is not part of t... (diff)
downloadsynapse-c5cec1cc77029c21f0117c318c522ab320de3923.tar.xz
Rename 'meta' to 'unsigned'
Diffstat (limited to '')
-rw-r--r--synapse/crypto/event_signing.py4
-rw-r--r--synapse/federation/replication.py14
-rw-r--r--synapse/federation/units.py1
3 files changed, 10 insertions, 9 deletions
diff --git a/synapse/crypto/event_signing.py b/synapse/crypto/event_signing.py
index 32d60bd30a..a236f7d708 100644
--- a/synapse/crypto/event_signing.py
+++ b/synapse/crypto/event_signing.py
@@ -47,7 +47,9 @@ def check_event_pdu_content_hash(pdu, hash_algorithm=hashlib.sha256):
 
 def _compute_content_hash(pdu, hash_algorithm):
     pdu_json = pdu.get_dict()
-    pdu_json.pop("meta", None)
+    #TODO: Make "age_ts" key internal
+    pdu_json.pop("age_ts")
+    pdu_json.pop("unsigned", None)
     pdu_json.pop("signatures", None)
     hashes = pdu_json.pop("hashes", {})
     pdu_json_bytes = encode_canonical_json(pdu_json)
diff --git a/synapse/federation/replication.py b/synapse/federation/replication.py
index c4993aa5ee..f2a5d4d5e2 100644
--- a/synapse/federation/replication.py
+++ b/synapse/federation/replication.py
@@ -295,10 +295,10 @@ class ReplicationLayer(object):
         transaction = Transaction(**transaction_data)
 
         for p in transaction.pdus:
-            if "meta" in p:
-                meta = p["meta"]
-                if "age" in meta:
-                    p["age"] = meta["age"]
+            if "unsigned" in p:
+                unsigned = p["unsigned"]
+                if "age" in unsigned:
+                    p["age"] = unsigned["age"]
             if "age" in p:
                 p["age_ts"] = int(self._clock.time_msec()) - int(p["age"])
                 del p["age"]
@@ -422,7 +422,7 @@ class ReplicationLayer(object):
         for p in pdus:
             if "age_ts" in p:
                 age = time_now - p["age_ts"]
-                p.setdefault("meta", {})["age"] = int(age)
+                p.setdefault("unsigned", {})["age"] = int(age)
                 del p["age_ts"]
         return Transaction(
             origin=self.server_name,
@@ -620,8 +620,8 @@ class _TransactionQueue(object):
                 if "pdus" in data:
                     for p in data["pdus"]:
                         if "age_ts" in p:
-                            meta = p.setdefault("meta", {})
-                            meta["age"] = now - int(p["age_ts"])
+                            unsigned = p.setdefault("unsigned", {})
+                            unsigned["age"] = now - int(p["age_ts"])
                             del p["age_ts"]
                 return data
 
diff --git a/synapse/federation/units.py b/synapse/federation/units.py
index c4a10a4123..c629e5793e 100644
--- a/synapse/federation/units.py
+++ b/synapse/federation/units.py
@@ -72,7 +72,6 @@ class Pdu(JsonEncodedObject):
         "prev_state_origin",
         "required_power_level",
         "user_id",
-        "meta"
     ]
 
     internal_keys = [