|
6 | 6 | #include "shared_context.h"
|
7 | 7 | #include "common_utils.h"
|
8 | 8 |
|
9 |
| -static const char *unknown_ticker = "???"; |
| 9 | +const char g_unknown_ticker[] = "???"; |
10 | 10 |
|
11 | 11 | // Mapping of chain ids to networks.
|
12 | 12 | static const network_info_t NETWORK_MAPPING[] = {
|
@@ -111,18 +111,21 @@ static const network_info_t NETWORK_MAPPING[] = {
|
111 | 111 | };
|
112 | 112 |
|
113 | 113 | static const network_info_t *get_network_from_chain_id(const uint64_t *chain_id) {
|
114 |
| - // Look if the network is available |
115 |
| - for (size_t i = 0; i < MAX_DYNAMIC_NETWORKS; i++) { |
116 |
| - if (DYNAMIC_NETWORK_INFO[i].chain_id == *chain_id) { |
117 |
| - PRINTF("[NETWORK] - Found dynamic %s\n", DYNAMIC_NETWORK_INFO[i].name); |
118 |
| - return (const network_info_t *) &DYNAMIC_NETWORK_INFO[i]; |
| 114 | + if (*chain_id != 0) { |
| 115 | + // Look if the network is available |
| 116 | + for (size_t i = 0; i < MAX_DYNAMIC_NETWORKS; i++) { |
| 117 | + if (DYNAMIC_NETWORK_INFO[i].chain_id == *chain_id) { |
| 118 | + PRINTF("[NETWORK] - Found dynamic %s\n", DYNAMIC_NETWORK_INFO[i].name); |
| 119 | + return (const network_info_t *) &DYNAMIC_NETWORK_INFO[i]; |
| 120 | + } |
119 | 121 | }
|
120 |
| - } |
121 |
| - // Fallback to hardcoded table |
122 |
| - for (size_t i = 0; i < ARRAYLEN(NETWORK_MAPPING); i++) { |
123 |
| - if (NETWORK_MAPPING[i].chain_id == *chain_id) { |
124 |
| - PRINTF("[NETWORK] - Fallback on hardcoded list. Found %s\n", NETWORK_MAPPING[i].name); |
125 |
| - return (const network_info_t *) &NETWORK_MAPPING[i]; |
| 122 | + // Fallback to hardcoded table |
| 123 | + for (size_t i = 0; i < ARRAYLEN(NETWORK_MAPPING); i++) { |
| 124 | + if (NETWORK_MAPPING[i].chain_id == *chain_id) { |
| 125 | + PRINTF("[NETWORK] - Fallback on hardcoded list. Found %s\n", |
| 126 | + NETWORK_MAPPING[i].name); |
| 127 | + return (const network_info_t *) &NETWORK_MAPPING[i]; |
| 128 | + } |
126 | 129 | }
|
127 | 130 | }
|
128 | 131 | return NULL;
|
@@ -177,7 +180,7 @@ const char *get_displayable_ticker(const uint64_t *chain_id, const chain_config_
|
177 | 180 | if (*chain_id == chain_cfg->chainId) {
|
178 | 181 | ticker = chain_cfg->coinName;
|
179 | 182 | } else {
|
180 |
| - ticker = unknown_ticker; |
| 183 | + ticker = g_unknown_ticker; |
181 | 184 | }
|
182 | 185 | }
|
183 | 186 | return ticker;
|
|
0 commit comments