From: Brian Warner Date: Thu, 11 Aug 2011 17:53:50 +0000 (-0700) Subject: fix SHARE_HASH_CHAIN_SIZE computation X-Git-Tag: trac-5200~4 X-Git-Url: https://git.rkrishnan.org/rgr-080307.php?a=commitdiff_plain;h=eec428ba5f3dd93c653a45e04dcd8274f0a3ce7a;p=tahoe-lafs%2Ftahoe-lafs.git fix SHARE_HASH_CHAIN_SIZE computation --- diff --git a/src/allmydata/mutable/layout.py b/src/allmydata/mutable/layout.py index 02069edd..30116414 100644 --- a/src/allmydata/mutable/layout.py +++ b/src/allmydata/mutable/layout.py @@ -548,10 +548,10 @@ MDMFOFFSETS_LENGTH = struct.calcsize(MDMFOFFSETS) PRIVATE_KEY_SIZE = 1220 SIGNATURE_SIZE = 260 VERIFICATION_KEY_SIZE = 292 -# We know we won't have more than 256 shares, and we know that we won't -# need to store more than lg 256 of them to validate, so that's our -# bound. We add 1 to the int cast to round to the next integer. -SHARE_HASH_CHAIN_SIZE = int(math.log(HASH_SIZE * 256)) + 1 +# We know we won't have more than 256 shares, and we know that we won't need +# to store more than ln2(256) hash-chain nodes to validate, so that's our +# bound. Each node requires 2 bytes of node-number plus 32 bytes of hash. +SHARE_HASH_CHAIN_SIZE = (2+HASH_SIZE)*mathutil.log_ceil(256, 2) class MDMFSlotWriteProxy: implements(IMutableSlotWriter)