From: Zooko O'Whielacronx Date: Thu, 20 Dec 2007 00:55:28 +0000 (-0700) Subject: fix representation of node ids in PeerTracker objects X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/file/URI:LIT:krugkidfnzsc4/(%5B%5E?a=commitdiff_plain;h=05b04d2b90a61346bd2a27a159d44c1a4162c6f8;p=tahoe-lafs%2Ftahoe-lafs.git fix representation of node ids in PeerTracker objects --- diff --git a/src/allmydata/upload.py b/src/allmydata/upload.py index 972de770..70ee2185 100644 --- a/src/allmydata/upload.py +++ b/src/allmydata/upload.py @@ -12,6 +12,7 @@ from allmydata.util.hashutil import file_renewal_secret_hash, \ storage_index_chk_hash, plaintext_segment_hasher, key_hasher from allmydata import encode, storage, hashtree, uri from allmydata.util import idlib, mathutil +from allmydata.util.assertutil import precondition from allmydata.interfaces import IUploadable, IUploader, IEncryptedUploadable from pycryptopp.cipher.aes import AES @@ -38,6 +39,8 @@ class PeerTracker: sharesize, blocksize, num_segments, num_share_hashes, storage_index, bucket_renewal_secret, bucket_cancel_secret): + precondition(isinstance(peerid, str), peerid) + precondition(len(peerid) == 20, peerid) self.peerid = peerid self.permutedid = permutedid self.connection = connection # to an RIClient @@ -61,7 +64,7 @@ class PeerTracker: def __repr__(self): return ("" - % (idlib.b2a(self.peerid)[:4], + % (idlib.shortnodeid_b2a(self.peerid), idlib.b2a(self.storage_index)[:6])) def query(self, sharenums):