From: Brian Warner <warner@lothar.com>
Date: Sat, 7 Jan 2012 22:12:26 +0000 (-0800)
Subject: Retrieve.decode(): simplify setup of DeferredList-like argument
X-Git-Url: https://git.rkrishnan.org/pf/reliability?a=commitdiff_plain;h=7f0bc6432569133b1b09a6a772a1f2b0ebfc8bf2;p=tahoe-lafs%2Ftahoe-lafs.git

Retrieve.decode(): simplify setup of DeferredList-like argument

make it more obviously match the expectations of _decode_blocks() and
_maybe_decode_and_decrypt_segment()
---

diff --git a/src/allmydata/mutable/retrieve.py b/src/allmydata/mutable/retrieve.py
index 0845d290..029818dc 100644
--- a/src/allmydata/mutable/retrieve.py
+++ b/src/allmydata/mutable/retrieve.py
@@ -323,11 +323,10 @@ class Retrieve:
         self._block_hash_trees = None
         self._setup_encoding_parameters()
 
-        # This is the form expected by decode.
-        blocks_and_salts = blocks_and_salts.items()
-        blocks_and_salts = [(True, [d]) for d in blocks_and_salts]
-
-        d = self._decode_blocks(blocks_and_salts, segnum)
+        # _decode_blocks() expects the output of a DeferredList that contains
+        # the outputs of _validate_block() (each of which is a dict mapping
+        # shnum to (block,salt) bytestrings).
+        d = self._decode_blocks([(True, blocks_and_salts)], segnum)
         d.addCallback(self._decrypt_segment)
         return d