diff --git a/src/hashtree.py b/src/hashtree.py --- a/src/hashtree.py +++ b/src/hashtree.py @@ -13,8 +13,8 @@ class HashTree: def __init__(self,leafCount): self.store=[b""]*(leafCount*2-1) self.leafStart=leafCount-1 - self.index=self.leafStart self.leafCount=leafCount + self._index=self.leafStart @classmethod def fromFile(cls,filename): @@ -52,14 +52,13 @@ class HashTree: with open(filename,"wb") as f: for h in self.store: f.write(h) - ## Inserts a leaf at the first empty position. - # + # # Useful and used only during the tree construction. def insertLeaf(self,h): - self.store[self.index]=h - self.index+=1 + self.store[self._index]=h + self._index+=1 ## Updates a hash stored in the leaf. def updateLeaf(self,index,h):