From: Zooko O'Whielacronx Date: Tue, 6 Jan 2009 00:46:45 +0000 (-0700) Subject: immutable: handle another form of share corruption with LayoutInvalid exception inste... X-Git-Url: https://git.rkrishnan.org/pf/content/en/(%5B%5E?a=commitdiff_plain;h=206ab2b44dd357dc83c3a529a6b6de938483a9f3;p=tahoe-lafs%2Ftahoe-lafs.git immutable: handle another form of share corruption with LayoutInvalid exception instead of AssertionError --- diff --git a/src/allmydata/immutable/download.py b/src/allmydata/immutable/download.py index 595818ec..ed9b77d4 100644 --- a/src/allmydata/immutable/download.py +++ b/src/allmydata/immutable/download.py @@ -404,7 +404,12 @@ class ValidatedReadBucketProxy(log.PrefixingLogMixin): if self.share_hash_tree.needed_hashes(self.sharenum): # This will raise exception if the values being passed do not match the root # node of self.share_hash_tree. - self.share_hash_tree.set_hashes(sharehashes) + try: + self.share_hash_tree.set_hashes(sharehashes) + except IndexError, le: + # Weird -- sharehashes contained index numbers outside of the range that fit + # into this hash tree. + raise BadOrMissingHash(le) # To validate a block we need the root of the block hash tree, which is also one of # the leafs of the share hash tree, and is called "the share hash".