Commit ccd661b
committed
fix(API): short-circuit read-only path before heavy imports and tighten network match
Two fixes from bugbot review of #1627:
1. Move dynamic imports of wallet / fullNodeRpc / persistance / V1+V2
models / fullNode AFTER the read-only short-circuit. The PR description
said the read-only path short-circuits before fetch, but the heavy
imports were happening unconditionally, which (a) made public observer
nodes load DB and wallet modules they don't need and (b) caused
/diagnostics to fail in the exact scenarios it's designed to survive
(e.g. V2 model module body failing to initialize).
2. Use exact equality (not substring containment) for the network match.
`"testnet10".includes("testnet1")` is true, so the previous code
reported a false match when the configured network was a prefix of
the actual one. The diagnostics endpoint's job is to tell the truth;
the existing assertChiaNetworkMatchInConfiguration still uses the
substring rule, but the `actual` and `configured` fields in the
response let operators spot whether the loose-match assertion would
also have considered them equivalent.1 parent 367ff89 commit ccd661b
1 file changed
Lines changed: 24 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | 228 | | |
236 | 229 | | |
237 | 230 | | |
238 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
239 | 240 | | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
243 | 251 | | |
244 | 252 | | |
245 | 253 | | |
| |||
340 | 348 | | |
341 | 349 | | |
342 | 350 | | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
343 | 359 | | |
344 | 360 | | |
345 | 361 | | |
346 | 362 | | |
347 | 363 | | |
348 | | - | |
| 364 | + | |
349 | 365 | | |
350 | 366 | | |
351 | 367 | | |
| |||
0 commit comments