# successful, then bht[0] will contain the root for the
# shnum, which will be a leaf in the share hash tree, which
# will allow us to validate the rest of the tree.
- if self.share_hash_tree.needed_hashes(reader.shnum,
- include_leaf=True) or \
- self._verify:
- try:
- self.share_hash_tree.set_hashes(hashes=sharehashes[1],
- leaves={reader.shnum: bht[0]})
- except (hashtree.BadHashError, hashtree.NotEnoughHashesError, \
- IndexError), e:
- raise CorruptShareError(reader.peerid,
- reader.shnum,
- "corrupt hashes: %s" % e)
+ try:
+ self.share_hash_tree.set_hashes(hashes=sharehashes[1],
+ leaves={reader.shnum: bht[0]})
+ except (hashtree.BadHashError, hashtree.NotEnoughHashesError, \
+ IndexError), e:
+ raise CorruptShareError(reader.peerid,
+ reader.shnum,
+ "corrupt hashes: %s" % e)
self.log('share %d is valid for segment %d' % (reader.shnum,
segnum))