Todas as lições · CKB node, RPC and indexer · Começa aqui · Glossário
Use indexer matched cell indexes to limit input parent fetchesPráticoDe uma correção
De uma correção · Verificação: certa · Verificada em 2026-11-19
With CCC client.findTransactionsPaged (scriptSearchMode 'prefix', groupByTransaction: true), each returned transaction has a cells list of {isInput, cellIndex} entries for the cells that matched the searched script. If your logic only needs the matched inputs, fetch parent transactions with getTransaction only for those indexes (plus siblings from a parent you already hold) and skip unrelated inputs such as wallet funding. OpenSwap's market scanner did this together with raising read concurrency to 16, and its first scan went from about 8 to 10 s to about 5.3 s; the gain from this change alone was not measured.
Porque importa: Without it, every input's parent transaction is fetched with getTransaction, including wallet funding cells the logic never uses, which multiplies RPC reads and slows the scan.
Padrão
for(const c of t.cells)if(c.isInput)f.inputs.add(Number(c.cellIndex));Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- toastmanAu/openswap:
frontend/test/markets-harness.ts,frontend/test/markets.spec.ts,pool-sdk/test/market-scan.test.ts,pool-sdk/test/market.test.ts
- Conceitos
- Indexer queries and cell collection, Network and RPC reliability
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-10-29
- Última mudança
- 2026-10-29
- Última verificação
- 2026-11-19
- Verificação contra o commit
- certa: a lição sai do commit e continua a valer no código de hoje
Fontes (1)
- 2026-10-29 · toastmanAu/openswap · mais deste projeto
Mais sobre CKB node, RPC and indexer
- get_live_cell may return "unknown" rather than "dead" for a spent output
- Wait for get_indexer_tip to reach the commit block before re-reading cells
- Check indexer lag with get_indexer_tip before signing
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Use indexer matched cell indexes to limit input parent fetches", CKB lessons, https://pulse.lusocryptolabs.com/learned/node/use-indexer-matched-cell-indexes-to-limit-input-parent-fetch, CC BY 4.0, last changed 2026-10-29.