Improve merkle proof and tx cache performance #29

Merged
jackrobison merged 4 commits from improve-tx-caches into master 2022-05-01 01:23:52 +02:00
Showing only changes of commit 6e69e1a272 - Show all commits

View file

@ -279,10 +279,9 @@ class MerkleCache:
class FastMerkleCacheItem: class FastMerkleCacheItem:
__slots__ = ['tx_hashes', 'tree', 'root_hash'] __slots__ = ['tree', 'root_hash']
def __init__(self, tx_hashes: typing.List[bytes]): def __init__(self, tx_hashes: typing.List[bytes]):
self.tx_hashes = tuple(tx_hashes)
self.tree: typing.List[typing.List[bytes]] = [] self.tree: typing.List[typing.List[bytes]] = []
self.root_hash = self._walk_merkle(tx_hashes, self.tree.append) self.root_hash = self._walk_merkle(tx_hashes, self.tree.append)