All lessons · CCC (TypeScript SDK) · Start here · Glossary
Clear the CCC client cache after a sent transaction loses a double spend raceWorkingFrom one fix
From one fix · Check: right · Checked 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.
Why it matters: 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.
Pattern
for(const c of clients)await c.cache.clear();Taken from the commit, shortened.
- Concepts
- Indexer queries and cell collection, Transaction building and fees
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-10-29
- Last changed
- 2026-10-29
- Last checked
- 2026-11-19
- Check against the commit
- right: the lesson follows from its commit and still holds in the code today
Sources (1)
- 2026-10-29 · toastmanAu/openswap · more from this project
More about CCC (TypeScript SDK)
- Deriving minimum cell capacity with ccc.CellOutput.from and output data
- Parsing snake_case JSON-RPC transactions in CCC
- Reserve co-signer witness space before completeFeeBy in multi-signer CCC transactions
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
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.