Todas as lições · CCC (TypeScript SDK) · Começa aqui · Glossário
Deriving minimum cell capacity with ccc.CellOutput.from and output dataPráticoReproduzida
Reproduzida · Verificação: certa · Verificada em 2026-11-19
In CCC, calling ccc.CellOutput.from({lock, type}, outputData) without a capacity fills capacity with the cell's occupied size, so it serves as the minimum capacity check for change or receipt cells. This commit uses it to reject dust change before and after subtracting the fee (via transaction.estimateFee), and to top up a receipt cell whose received CKB is below its occupied capacity.
Porque importa: Without deriving occupied capacity, change or receipt outputs can fall below the cell's minimum capacity (for example after the fee is subtracted, or when a small CKB amount is received), producing a transaction the node rejects for insufficient output capacity.
Padrão
return ccc.CellOutput.from({lock:cell.cellOutput.lock,type:cell.cellOutput.type},cell.outputData).capacity;Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- toastmanAu/openswap:
pool-sdk/test/builders.test.ts,pool-sdk/test/cli.test.ts,pool-sdk/test/codec.test.ts,pool-sdk/test/transport.test.ts,pool-sdk/test/vm-bridge.ts
Reproduzida por um teste
Um teste público corre o que esta lição diz em @ckb-ccc/core 1.23.1, sem nó. Qualquer pessoa o pode correr.
tests/ccc/minimum-capacity.test.mjs
- Conceitos
- Capacity and cell size, Transaction building and fees
- Evidência
- Reproduzida: reproduzida por um teste público
- Vista pela primeira vez
- 2026-10-01
- Última mudança
- 2026-10-01
- Ú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-01 · toastmanAu/openswap · mais deste projeto
Mais sobre CCC (TypeScript SDK)
- completeFeeBy adds change instead of shrinking outputs, breaking output bound proofs
- Parsing snake_case JSON-RPC transactions in CCC
- Reserve co-signer witness space before completeFeeBy in multi-signer CCC transactions
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Deriving minimum cell capacity with ccc.CellOutput.from and output data", CKB lessons, https://pulse.lusocryptolabs.com/learned/ccc/deriving-minimum-cell-capacity-with-ccc-celloutput-from-and, CC BY 4.0, last changed 2026-10-01.