Todas as lições · CKB node, RPC and indexer · Começa aqui · Glossário
Filter prefix get_cells results by data length before decodingPráticoDe uma correção
De uma correção · Verificação: certa · Verificada em 2026-11-19
A get_cells query with script_search_mode "prefix" and args "0x" returns every live cell whose script has that code hash and hash_type, whatever its args, so it can include cells of the same script with a different data layout (for example a script that owns both a state cell and a ledger cell). Check output_data length, or catch the decode error, and skip the cell before calling a strict decoder. Otherwise one unexpected cell throws and the whole result list is lost.
Porque importa: Without the length check one cell with a different data length makes the strict decoder throw, and the page shows no rounds at all instead of the rounds that exist.
Padrão
if (data.length !== ROUND_CONFIG_SIZE) continue; // not a round config cellTirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- toastmanAu/daowow:
apps/web/test/discovery.test.js
- Conceitos
- Indexer queries and cell collection, Data encoding (molecule, hex, bigints)
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-09-18
- Última mudança
- 2026-09-18
- Ú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-09-18 · toastmanAu/daowow · mais deste projeto
Mais sobre CKB node, RPC and indexer
- Nervos DAO phase 1 withdrawing cells keep the DAO type; count deposits by 8 zero bytes of data
- Finding cells of a ckb_js_vm JS contract needs a second indexer prefix search
- Check chain-wide script users before consuming a deployed code cell
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Filter prefix get_cells results by data length before decoding", CKB lessons, https://pulse.lusocryptolabs.com/learned/node/filter-prefix-get-cells-results-by-data-length-before-decodi, CC BY 4.0, last changed 2026-09-18.