All lessons · Other · Start here · Glossary
Restrict script hashType to data, type, data1, data2 when loading configWorkingFrom one fix
From one fix · Check: right · Checked 2026-11-19
CKB hash_type encodes as data=0, type=1, data1=2, data2=4 (no value 3), so a config loader should reject any hashType string outside data/type/data1/data2 rather than map it loosely. A wrong code hash or hash type makes cell discovery watch the wrong cells and silently return empty results.
Why it matters: A loosely parsed hashType can silently land on a real but wrong hash type, so discovery watches the wrong cells and returns an empty result that looks like a round that has not opened yet.
hash_type validation, not covered
Pattern
const HASH_TYPES = Object.freeze(["data", "type", "data1", "data2"]);Taken from the commit, shortened.
A test changed in the same commit
It sits next to the fix. We did not run it.
- toastmanAu/daowow:
apps/web/test/manifest.test.js
- Concepts
- Cell deps and script lookup, Data encoding (molecule, hex, bigints)
- Evidence
- From one fix: from one project, checked against its commit
- First seen
- 2026-09-18
- Last changed
- 2026-09-18
- 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-09-18 · toastmanAu/daowow · more from this project
More about Other
- Recognizing a Nervos DAO deposit cell (not a withdrawing one)
- Hand-encoding WitnessArgs in molecule
- Nervos DAO phase-one withdrawal layout
Do you maintain a project this lesson came from? Confirm or correct it
Cite this lesson
LusoCryptoLabs, "Restrict script hashType to data, type, data1, data2 when loading config", CKB lessons, https://pulse.lusocryptolabs.com/learned/other/restrict-script-hashtype-to-data-type-data1-data2-when-loadi, CC BY 4.0, last changed 2026-09-18.