CKB Pulse

Todas as lições · CCC (TypeScript SDK) · Começa aqui · Glossário

Clear the CCC client cache after a sent transaction loses a double spend racePráticoDe uma correção

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

A CCC client caches the outputs of every transaction it sent, so when that transaction loses a race for the same input and never commits, its change cells still look usable to later builds. This campaign calls client.cache.clear() on every client before rebuilding and confirms candidate cells with getCellLiveNoCache rather than trusting cached state.

Porque importa: Without clearing, the losing client's cache still lists that transaction's change outputs as spendable and its inputs as spent, so rebuilds pick cells that do not exist on chain and the node rejects them.

Padrão

Preferir
for(const c of clients)await c.cache.clear();

Tirado do commit, encurtado.

Conceitos
Indexer queries and cell collection, Transaction building and fees
Evidência
De uma correção: de um projeto, verificada contra o commit
Vista pela primeira vez
2026-10-29
Última mudança
2026-10-29
Ú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, "Clear the CCC client cache after a sent transaction loses a double spend race", CKB lessons, https://pulse.lusocryptolabs.com/learned/ccc/clear-the-ccc-client-cache-after-a-sent-transaction-loses-a, CC BY 4.0, last changed 2026-10-29.

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.