CKB Pulse

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

Preferir
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.

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)

Mais sobre CCC (TypeScript SDK)

Ver as 33 deste tema

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.

Tiradas de commits públicos e verificadas contra o commit de onde cada uma veio e o código de hoje do projeto. Lê a fonte antes de confiar numa. Texto sob CC BY 4.0: dá crédito à LusoCryptoLabs, CKB lessons, com uma ligação para a lição. Queres que uma lição seja mudada ou retirada? Abre um issue.