eth-cache

Ethereum chain data caching tools
Log | Files | Refs | LICENSE

commit cc11ebc2d006921eb4e56b8fc42af7f04768fc2b
parent 9129e4ab3de8cd2eb50e1d621a80bb8ef9e05be5
Author: lash <dev@holbrook.no>
Date:   Sun, 16 Jun 2024 23:53:15 +0100

Abstract remaining calls in get_tx for add_dir and filepath

Diffstat:
Meth_cache/store/file.py | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/eth_cache/store/file.py b/eth_cache/store/file.py @@ -22,6 +22,12 @@ logg = logging.getLogger(__name__) class FileStore(FsStore): + + def add_address_dir(self, dirhsh, address): + address_dir_adder = self.adder[StoreAction.ADDRESS] + address_dir_adder.add_dir(dirhsh, address, b'') + + def put_tx(self, tx, include_data=False): raw = pack(tx.src, self.chain_spec) tx_hash_dirnormal = strip_0x(tx.hash).upper() @@ -41,10 +47,12 @@ class FileStore(FsStore): a_hex = strip_0x(a).upper() a = bytes.fromhex(a_hex) #self.address_dir.add_dir(tx_hash_dirnormal, a, b'') - address_dir_adder = self.adder[StoreAction.ADDRESS] - address_dir_adder.add_dir(tx_hash_dirnormal, a, b'') + #address_dir_adder = self.adder[StoreAction.ADDRESS] + #address_dir_adder.add_dir(tx_hash_dirnormal, a, b'') + self.add_address_dir(tx_hash_dirnormal, a) #dirpath = self.address_dir.to_filepath(a_hex) - dirpath = address_dir_adder.to_filepath(a_hex) + #dirpath = address_dir_adder.to_filepath(a_hex) + dirpath = self.to_filepath(StoreAction.ADDRESS, a_hex) fp = os.path.join(dirpath, '.start') num = tx.block.number num_compare = 0