CKB Pulse
Lessons

What CKB learned

Start here · Glossary · Test yourself · Feed

RaheemJnr/pocket-node

Lessons from RaheemJnr/pocket-node

github.com/RaheemJnr/pocket-node

Do you maintain this project? Confirm its lessons in one issue

5 lessons found. All lessons

Light client still reports a removed script until the new script set landsWorkingFrom one fix

The CKB light client keeps reporting a script, with its block number, from get_scripts until you register a new script set that leaves it out. A sync poll that runs between your local delete and that set_scripts call will still see the removed script. Do not let that poll recreate local per script progress for an owner that no longer exists, and clear that progress again once the new set is registered while polling is excluded.

#Indexer queries and cell collection #Network and RPC reliability · Sources (1) · 2026-10-11

Light client scan absence does not prove a DAO withdrawing cell was spentWorkingFrom one fix

With the CKB light client, a DAO withdrawing cell older than the script's sync start is never returned by the scan, and the phase-2 unlock output is a plain cell that does not point back at it. So absence from the scan cannot mark the position spent: retire it only when the unlock transaction is confirmed (a verified local inclusion, or getTransactionStatus reporting committed on the node), keep it shown as confirming while the unlock is in flight, and never treat an unreachable node or an unknown transaction as a spend.

#Indexer queries and cell collection #Other · Sources (2) · 2026-10-09

Light client sync progress poll racing set_scriptsAdvancedFrom one fix

If an app saves per-script sync progress from the light client's get_scripts while another path calls set_scripts to reset or re-register scripts, a get_scripts result read before the set landed can overwrite the reset progress. Do the get_scripts read and the progress write under the same lock that guards set_scripts, and have the poll use tryLock and skip that tick while a registration is in flight, so it never queues behind it. Pocket Node does this in SyncCoordinator.tryWithRegistrationLock.

#Indexer queries and cell collection #Network and RPC reliability · Sources (1) · 2026-10-06

DAO compensation must use the deposit cell's occupied capacity (102 CKB), not 61WorkingFrom one fix

When calculating Nervos DAO max withdraw or compensation (here via the light client's nativeCalculateMaxWithdraw), pass the occupied capacity of the actual DAO deposit cell (102 CKB for a secp256k1 lock plus DAO type plus 8 bytes data), not the 61 CKB of a plain secp256k1 cell. Using 61 overstates the interest by (C - 61) / (C - 102), and the result no longer matches what the unlock transaction pays out.

#Capacity and cell size · Sources (1) · 2026-10-06

Light client set_scripts "all" replaces the whole registered script setWorkingFrom one fix

The CKB light client's set_scripts with the all command replaces every registered script, so a call carrying only one wallet's lock script unregisters all other wallets. When several scripts must stay tracked, either pass the full set with each script's own start block, or use the partial command to update only the changed script. If registrations can race, serialise them so a stale full set cannot overwrite a newer one.

#Indexer queries and cell collection #Network and RPC reliability · Sources (1) · 2026-09-30

Text under CC BY 4.0: credit LusoCryptoLabs, CKB lessons, with a link to the lesson. JSON · Want a lesson changed or removed? Open an issue.