]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
mutable/layout.py: make unpack_sdmf_checkstring and unpack_mdmf_checkstring more...
authordavid-sarah <david-sarah@jacaranda.org>
Sun, 25 Sep 2011 02:36:51 +0000 (19:36 -0700)
committerdavid-sarah <david-sarah@jacaranda.org>
Sun, 25 Sep 2011 02:36:51 +0000 (19:36 -0700)
src/allmydata/mutable/layout.py
src/allmydata/mutable/publish.py

index 91486957c938682e0cabbdfa7d6d9b58f0ca4864..848940141bde6980dbbf38f7f679ed5ac47ea8c7 100644 (file)
@@ -143,16 +143,13 @@ def get_version_from_checkstring(checkstring):
 def unpack_sdmf_checkstring(checkstring):
     cs_len = struct.calcsize(PREFIX)
     version, seqnum, root_hash, IV = struct.unpack(PREFIX, checkstring[:cs_len])
-    if version != 0: # TODO: just ignore the share
-        raise UnknownVersionError("got mutable share version %d, but I only understand version 0" % version)
+    assert version == SDMF_VERSION, version
     return (seqnum, root_hash, IV)
 
 def unpack_mdmf_checkstring(checkstring):
     cs_len = struct.calcsize(MDMFCHECKSTRING)
-    checkstring = checkstring[:cs_len]
-    version, seqnum, root_hash = struct.unpack(MDMFCHECKSTRING, checkstring)
-
-    assert version == 1
+    version, seqnum, root_hash = struct.unpack(MDMFCHECKSTRING, checkstring[:cs_len])
+    assert version == MDMF_VERSION, version
     return (seqnum, root_hash)
 
 def pack_offsets(verification_key_length, signature_length,
index 8e4ef514ae5021300f1d7b06469c7a27b05d39df..036bf51d23d91ee9ee0ac87a01e8b14406ecf7ae 100644 (file)
@@ -1112,7 +1112,7 @@ class Publish:
                 elif version == SDMF_VERSION:
                     (other_seqnum,
                      other_roothash,
-                     other_salt) = unpack_sdmf_checkstring(checkstring)
+                     other_IV) = unpack_sdmf_checkstring(checkstring)
                 else:
                     unknown_format = True
                 expected_version = self._servermap.version_on_peer(peerid,