Skip to content

Health check fix#1584

Merged
TheLastCicada merged 3 commits into
developfrom
v2-rc2
Apr 16, 2026
Merged

Health check fix#1584
TheLastCicada merged 3 commits into
developfrom
v2-rc2

Conversation

@TheLastCicada

@TheLastCicada TheLastCicada commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Note

Medium Risk
Touches wallet RPC discovery logic used by health checks and potentially other runtime paths; incorrect enum handling or caching behavior could affect wallet availability reporting in production.

Overview
Fixes DataLayer wallet discovery by switching the get_wallets lookup to the correct chia-blockchain WalletType.DATA_LAYER value (11), and extracting the parsing logic into a new pure helper findDLWalletInResponse.

Adds test hooks (__test_resetDLWalletCache) and updates/extends integration coverage around wallet-id discovery, plus introduces a new live test (wallet-health.live.spec.js) that validates both CADT’s /health/wallet response and the underlying wallet RPC get_wallets types. CI live workflows now run this new wallet health sanity check in both v1 and v2 live test jobs via the new test:v2:live:wallet-health script.

Reviewed by Cursor Bugbot for commit 374c9f3. Bugbot is set up for automated code reviews on this repo. Configure here.

getDLWalletId() was searching for WalletType 14 but chia-blockchain
defines DATA_LAYER as 11 (and has since 2022). This meant the entire
transaction health and recovery system — rejected tx detection,
auto-clearing, DL unconfirmed tx gating — was silently disabled on
real nodes.

The original integration test was tautological: it stubbed type 14 in
the mock response then asserted CADT found type 14. It also ran under
USE_SIMULATOR=true which short-circuits getDLWalletId() to return '2'
without ever hitting the RPC path.

- Extract findDLWalletInResponse() pure function with named constant
  CHIA_WALLET_TYPE_DATA_LAYER = 11, testable without simulator bypass
- Add __test_resetDLWalletCache() to prevent cross-test cache leakage
- Replace tautological test with findDLWalletInResponse unit tests
  that validate the constant value and reject adjacent type values
- Add live-api test (wallet-health.live.spec.js) that calls the real
  Chia wallet RPC get_wallets and verifies CADT's constant matches
- Run wallet-health live test in both v1 and v2 CI jobs as an early
  sanity check before the longer org-creation tests
- Fall back on 403 (not just 404) when v2 is disabled in v1-only CI
- Move wallet-health test after org creation so the DataLayer wallet
  exists (Chia auto-creates it on first datalayer interaction)
fix: correct DataLayer wallet type constant from 14 to 11
@TheLastCicada TheLastCicada merged commit e2ac103 into develop Apr 16, 2026
14 checks passed
@TheLastCicada TheLastCicada deleted the v2-rc2 branch April 16, 2026 16:13
@TheLastCicada TheLastCicada restored the v2-rc2 branch April 16, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant