Commit 5275d27
committed
fix(API): treat CHIA_NETWORK as binary mainnet vs testnet in /diagnostics
CADT's CHIA_NETWORK config is a binary mainnet-vs-testnet flag, not an
exact chia network name. Cross-referenced against every use in the
codebase:
- defaultConfig.js sets it to 'mainnet'
- config-loader.js forces it to the literal string 'testnet' when
USE_SIMULATOR=true, regardless of the actual underlying network
- coin-management.js branches on '=== mainnet ? XCH : TXCH'
- data-assertions.js accepts any chia network whose name contains
CHIA_NETWORK as a substring
The CI run on commit 286fcbb confirmed the previous strict-equality
check gave the wrong answer in the real world: chia reported 'testneta',
CADT config was 'testnet', diagnostics reported matches:false even
though CADT itself treats them as a match.
Normalize both sides to mainnet|testnet before comparing. This is both
strictly more correct than the original substring rule (no
testnet1/testnet10 false positive) and operationally aligned with how
the rest of CADT interprets CHIA_NETWORK.
The existing assertChiaNetworkMatchInConfiguration still uses the
substring rule -- harmonising the assertion with this normalised
comparison is a sensible follow-up but is left out of this PR to keep
the scope tight.1 parent 286fcbb commit 5275d27
2 files changed
Lines changed: 61 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
359 | 365 | | |
360 | 366 | | |
361 | 367 | | |
362 | 368 | | |
| 369 | + | |
363 | 370 | | |
364 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
365 | 374 | | |
366 | 375 | | |
367 | 376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
268 | 311 | | |
269 | 312 | | |
270 | 313 | | |
| |||
0 commit comments