Todas as lições · Rust scripts and ckb-std · Começa aqui · Glossário
Iterating group inputs and outputs with ckb-std until IndexOutOfBoundPráticoDe uma correção
De uma correção · Verificação: certa · Verificada em 2026-11-19
In a ckb-std script, walk the cells of a source with the high-level loaders, for example load_cell_type_hash(i, Source::GroupInput) or load_cell_lock_hash(j, Source::Output), in an index loop. Break on Err(SysError::IndexOutOfBound), and return a script error code for any other SysError. Accumulate the u64 capacities you load in a u128 so that a sum over many cells cannot overflow.
Porque importa: Without the IndexOutOfBound break the loop has no clean end condition, and treating every load error as the end of the list would hide real syscall failures.
Padrão
Err(SysError::IndexOutOfBound) => break,Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- salmansarwarr/Tranfr:
sdk/tests/client.test.ts,sdk/tests/scaffold.test.ts,tests/src/tests.rs
- Conceitos
- Capacity and cell size, Cell deps and script lookup
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-11-08
- Última mudança
- 2026-11-08
- Ú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-11-08 · salmansarwarr/Tranfr · mais deste projeto
Mais sobre Rust scripts and ckb-std
- Minimum capacity of a cell depends on its lock args length
- Check that a derived successor type args match the spent cell's type args
- Cheque lock receiver path must return the cell's capacity to the sender
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Iterating group inputs and outputs with ckb-std until IndexOutOfBound", CKB lessons, https://pulse.lusocryptolabs.com/learned/scripts/iterating-group-inputs-and-outputs-with-ckb-std-until-indexo, CC BY 4.0, last changed 2026-11-08.