fix: preserve ENS names on lookup failure, add debug logging (closes #22) #24
Reference in New Issue
Block a user
Delete Branch "fix/ens-reverse-lookup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes #22: ENS reverse lookups appearing broken — addresses show bare hex even when they have a .eth reverse.
Root Cause
Two issues that could cause ENS names to disappear:
refreshBalances(balances.js): On ENS lookup error (timeout, RPC failure, etc.),addr.ensNamewas set tonull, wiping any previously resolved name. SincesaveState()runs after refresh, thisnullgets persisted. Next popup open shows no ENS name, and if the error continues, it never recovers.ENS cache (ens.js): Failed lookups were cached as
nullwith a 12-hour TTL. Even after the transient error resolved,resolveEnsName()would return the cachednullwithout retrying the RPC call.Fix
refreshBalances: on error, keep the existingaddr.ensNamevalue instead of overwriting withnullens.js: don't cache failed lookups — let subsequent calls retry immediatelyTesting
make checkpasses (14 tests + prettier).Code Review
LGTM — fixes the root cause of ENS names disappearing:
ens.js: no longer caches failures, so transient RPC errors don't block retries for 12hbalances.js:catchblock preserves existingaddr.ensNameinstead of overwriting withnullThis should be merged before PR #25, which complements it by ensuring ENS lookups run for ALL addresses in tx lists (not just counterparties).
Formatting clean. Assigning to sneak.