CKB Pulse

Todas as lições · Other · Começa aqui · Glossário

Recompute occupied capacity when a state cell grows in a transitionPráticoDe uma correção

De uma correção · Verificação: certa · Verificada em 2026-11-19

When a transaction replaces a cell with one holding larger data (here 101 to 207 bytes under the same type script), compute the new occupied floor as 8 + data length + lock (32 code hash + 1 hash type + args) + type (32 + 1 + args) bytes in CKB, and top up from another input if the old capacity falls short (312 CKB input vs a 318 CKB floor here). If the type script also requires output capacity >= input capacity, use the larger of the two bounds rather than shrinking to the floor.

Porque importa: Reusing the old cell's 312 CKB for a 207-byte replacement leaves the output below its 318 CKB occupied floor, so the node rejects the transaction. Shrinking a well-funded cell down to that floor would instead fail the type script's out_cap >= in_cap check.

adds top up and max(floor, input capacity) rule beyond the occupied capacity formula lesson

Padrão

Preferir
const ledgerCapacity = floor > inCap ? floor : inCap;

Tirado do commit, encurtado.

Um teste mudou no mesmo commit

Está ao lado da correcção. Nós não o corremos.

Conceitos
Capacity and cell size, Transaction building and fees
Evidência
De uma correção: de um projeto, verificada contra o commit
Vista pela primeira vez
2026-09-25
Última mudança
2026-09-25
Ú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 Other

Ver as 9 deste tema

Manténs um projeto de onde esta lição veio? Confirma ou corrige

Citar esta lição
LusoCryptoLabs, "Recompute occupied capacity when a state cell grows in a transition", CKB lessons, https://pulse.lusocryptolabs.com/learned/other/recompute-occupied-capacity-when-a-state-cell-grows-in-a-tra, CC BY 4.0, last changed 2026-09-25.

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.