From 206ab2b44dd357dc83c3a529a6b6de938483a9f3 Mon Sep 17 00:00:00 2001 From: Zooko O'Whielacronx Date: Mon, 5 Jan 2009 17:46:45 -0700 Subject: [PATCH] immutable: handle another form of share corruption with LayoutInvalid exception instead of AssertionError --- src/allmydata/immutable/download.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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". -- 2.45.2