Retrieve.decode(): simplify setup of DeferredList-like argument
authorBrian Warner <warner@lothar.com>
Sat, 7 Jan 2012 22:12:26 +0000 (14:12 -0800)
committerBrian Warner <warner@lothar.com>
Sun, 8 Jan 2012 22:12:40 +0000 (14:12 -0800)
make it more obviously match the expectations of _decode_blocks() and
_maybe_decode_and_decrypt_segment()

src/allmydata/mutable/retrieve.py

index 0845d29086912838c66ae1e240b769875e75d849..029818dcd39172b3862a78f9bd63ee58643923bc 100644 (file)
@@ -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