CKB Pulse

All lessons · CKB node, RPC and indexer · Start here · Glossary

Indexer get_cells order is by script args, not by cell ageWorkingFrom one fix

From one fix · Check: right · Checked 2026-11-19

Cells returned by a prefix search on type script args (as findRounds does here) come back in indexer key order, sorted by type args, not by creation time, so taking the first result does not give the newest cell. To get the latest, sort by a field stored in the cell (here the round config's entryStart).

Why it matters: Taking the first cell of a prefix search picks whichever cell has the smallest script args, not the newest one. Here that was a dead round, so the entry and refund pages could not reach the live round or the round with pending refunds.

Pattern

Avoid
const round = rounds[0];

Taken from the commit, shortened.

A test changed in the same commit

It sits next to the fix. We did not run it.

Concepts
Indexer queries and cell collection
Evidence
From one fix: from one project, checked against its commit
First seen
2026-11-09
Last changed
2026-11-09
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)

More about CKB node, RPC and indexer

All 45 in this topic

Do you maintain a project this lesson came from? Confirm or correct it

Cite this lesson
LusoCryptoLabs, "Indexer get_cells order is by script args, not by cell age", CKB lessons, https://pulse.lusocryptolabs.com/learned/node/indexer-get-cells-order-is-by-script-args-not-by-cell-age, CC BY 4.0, last changed 2026-11-09.

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.