From 747ac575fad0b65d6a7f049572bbff510b7211a7 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Mon, 14 Jul 2025 16:28:50 +1000 Subject: [PATCH] fix: Auto reset cache if incorrect format --- render.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/render.py b/render.py index 308639d..680982b 100644 --- a/render.py +++ b/render.py @@ -40,6 +40,24 @@ if TX_EXPLORER_URL is None: NAMEHASH_CACHE = 'user_data/namehash_cache.json' +# Validate cache version +if os.path.exists(NAMEHASH_CACHE): + with open(NAMEHASH_CACHE, 'r') as f: + cache = json.load(f) + if not isinstance(cache, dict): + print("Invalid namehash cache format. Resetting cache.") + with open(NAMEHASH_CACHE, 'w') as f: + json.dump({}, f) + # Check if cache entries are valid + for key in cache: + if not cache[key].startswith("