Create cache dir if not exists
This commit is contained in:
parent
e6aa8a2aed
commit
54d60bc674
@ -70,6 +70,8 @@ def get_transaction_hashes(calls: List[Trace]) -> List[str]:
|
|||||||
def cache_block(cache_path: Path, block: Block):
|
def cache_block(cache_path: Path, block: Block):
|
||||||
write_mode = "w" if cache_path.is_file() else "x"
|
write_mode = "w" if cache_path.is_file() else "x"
|
||||||
|
|
||||||
|
cache_path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
with open(cache_path, mode=write_mode) as cache_file:
|
with open(cache_path, mode=write_mode) as cache_file:
|
||||||
cache_file.write(block.json())
|
cache_file.write(block.json())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user