Optimize chain validation and improve fallback comments

Co-authored-by: k9ert <117085+k9ert@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-02-05 20:34:22 +00:00
parent a94ab56e05
commit 5b7e10ca92
2 changed files with 7 additions and 2 deletions

View file

@ -101,10 +101,13 @@ def validate_network_for_chain(chain_name, network_params):
# If we don't recognize the chain, but got 'ert' prefix, it's likely wrong
if expected_prefix is None and actual_prefix == "ert":
known_chains_list = ", ".join(sorted(expected_prefixes.keys()))
# Build list of recognized chains (cached as part of function for efficiency)
if not hasattr(validate_network_for_chain, '_known_chains_text'):
validate_network_for_chain._known_chains_text = ", ".join(sorted(expected_prefixes.keys()))
return (False,
f"Chain '{chain_name}' is not recognized. "
f"Recognized chains: {known_chains_list}. "
f"Recognized chains: {validate_network_for_chain._known_chains_text}. "
f"Note: testnet4 support requires updating the embit library.")
# If we know the chain, verify the prefix matches

View file

@ -230,9 +230,11 @@ class AbstractNode(NonExistingNode):
"Wallet operations may fail with this chain configuration."
)
# Return safe fallback to prevent crashes during node info display
# Use 'main' as it's the most stable/tested network in the codebase
# Actual wallet operations will fail with clear error from Wallet.network
return get_network("main")
return network_params
# Default to 'main' when node is not running - safe, stable fallback
return get_network("main")
def check_blockheight(self):