From a911e15783e6fca7eabc926b93b0c2a9eb0c8feb Mon Sep 17 00:00:00 2001
From: kevan <kevan@isnotajoke.com>
Date: Sat, 24 Sep 2011 16:51:37 -0700
Subject: [PATCH] mutable/publish: use unpack_mdmf_checkstring and
 unpack_sdmf_checkstring instead of unpack_checkstring. fixes #1540

---
 src/allmydata/mutable/publish.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/allmydata/mutable/publish.py b/src/allmydata/mutable/publish.py
index 0eceedb1..edd30e48 100644
--- a/src/allmydata/mutable/publish.py
+++ b/src/allmydata/mutable/publish.py
@@ -18,8 +18,11 @@ from foolscap.api import eventually, fireEventually
 from allmydata.mutable.common import MODE_WRITE, MODE_CHECK, \
      UncoordinatedWriteError, NotEnoughServersError
 from allmydata.mutable.servermap import ServerMap
-from allmydata.mutable.layout import unpack_checkstring, MDMFSlotWriteProxy, \
-                                     SDMFSlotWriteProxy
+from allmydata.mutable.layout import get_version_from_checkstring,\
+                                     unpack_mdmf_checkstring, \
+                                     unpack_sdmf_checkstring, \
+                                     MDMFSlotWriteProxy, \
+                                     SDMFSlotWriteProxy, MDMFCHECKSTRING
 
 KiB = 1024
 DEFAULT_MAX_SEGMENT_SIZE = 128 * KiB
@@ -1101,9 +1104,14 @@ class Publish:
             # use the checkstring to add information to the log message
             for (shnum,readv) in read_data.items():
                 checkstring = readv[0]
-                (other_seqnum,
-                 other_roothash,
-                 other_salt) = unpack_checkstring(checkstring)
+                version = get_version_from_checkstring(checkstring)
+                if version == MDMF_VERSION:
+                    (other_seqnum,
+                     other_roothash) = unpack_mdmf_checkstring(checkstring)
+                else:
+                    (other_seqnum,
+                     other_roothash,
+                     other_salt) = unpack_sdmf_checkstring(checkstring)
                 expected_version = self._servermap.version_on_peer(peerid,
                                                                    shnum)
                 if expected_version:
-- 
2.45.2