All lessons · Light client · Start here · Glossary
Light client sync progress poll racing set_scriptsAdvancedFrom one fix
From one fix · Check: partly right · Checked 2026-11-19
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.
Why it matters: A poll tick that read get_scripts before a resync's set_scripts landed writes the old block number back, so the user's reset is silently undone and the wallet resumes from stale progress.
A test changed in the same commit
It sits next to the fix. We did not run it.
- RaheemJnr/pocket-node:
android/app/src/test/java/com/rjnr/pocketnode/data/gateway/GatewayRepositoryResyncStrategyTest.kt,android/app/src/test/java/com/rjnr/pocketnode/data/gateway/RegistrationLockTest.kt,android/app/src/test/java/com/rjnr/pocketnode/data/gateway/TestGatewayRepository.kt
- Concepts
- Indexer queries and cell collection, Network and RPC reliability
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-10-06
- Last changed
- 2026-10-06
- Last checked
- 2026-11-19
- Check against the commit
- partly right: a true core, with a part that is loose or too wide
Sources (1)
- 2026-10-06 · RaheemJnr/pocket-node · more from this project
More about Light client
- Give light clients the committing block of a cell, not just its outpoint
- Light client set_scripts "all" replaces the whole registered script set
- Light client still reports a removed script until the new script set lands
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Light client sync progress poll racing set_scripts", CKB lessons, https://pulse.lusocryptolabs.com/learned/light-client/light-client-sync-progress-poll-racing-set-scripts, CC BY 4.0, last changed 2026-10-06.