Direct balance worker testing - bypass API and test worker queue directly
npm install @pioneer-platform/test-balance-workerInjects test jobs directly into the Redis queue that the LIVE running worker (from make start) is processing.
Isolate and debug the balance worker to understand:
- How xpubs are processed
- How tokens array is populated (derived addresses)
- How receive vs change addresses are filtered
- Why addresses might not be appearing in integration tests
getPubkeyInfo() to get derived addressestokens[] array with addresses and pathsUses hardcoded real xpubs from KeepKey integration test wallet:
- BTC: legacy (xpub), segwit (ypub), native segwit (zpub)
- LTC: legacy (xpub), native segwit (zpub)
- DOGE, BCH, DASH, DGB: legacy (xpub)
- ETH, COSMOS, XRP: single addresses
CRITICAL: Pioneer server must be running!
``bashTerminal 1: Start pioneer-server with worker
cd /Users/highlander/WebstormProjects/keepkey-stack/projects/pioneer
make start
Usage
`bash
Terminal 2: Run queue injection test
cd e2e/workers/test-balance-worker
bun run devThe test will:
1. Connect to Redis
2. Inject job with hardcoded xpubs
3. Watch the LIVE worker process it
4. Check Redis for derived addresses
`Expected Output
$3
`
š Testing BTC:
š LEGACY (xpub):
ā
Response received:
Balance: 0 satoshis
Tokens: 20 addresses šÆ First 5 derived addresses:
[1] bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh
Path: m/84'/0'/0'/0/0
Balance: 0 satoshis
š Address breakdown:
Receive addresses (/0/N): 10
Change addresses (/1/N): 10
Total: 20
ā
Gap limit reached
`$3
`
š Testing BTC:
š LEGACY (xpub):
ā
Response received:
Balance: 0 satoshis
Tokens: 0 addresses
ā ļø NO TOKENS ARRAY - This is the problem!
š Full response structure: {...}
`Debugging
If tokens array is empty, check:
1. Blockbook API: Is
getPubkeyInfo() returning data?
2. Response parsing: Is the response structure correct?
3. Token filtering: Are tokens being filtered out?
4. Network module: Is utxo-network module initialized?Integration with Server
Once this test passes, addresses from
tokens[] should:
1. Be stored in Redis: user:{username}:addresses:{networkId}
2. Be published to watchtower via user_connect` eventIf this test reveals issues:
- Add logging to utxo-network module
- Check Blockbook API responses
- Verify token parsing logic
- Test with different xpub types