CKB Pulse

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.

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)

More about Light client

All 5 in this topic

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.

Drawn from public commits and checked against the commit each one came from and the project's code today. Read the source before you rely on one. Text under CC BY 4.0: credit LusoCryptoLabs, CKB lessons, with a link to the lesson. Want a lesson changed or removed? Open an issue.