docs(model/block): document BlockIDs[0] == GenesisBlockID invariant#974
Conversation
…sv-blockchain#967) Spell out why the [0] access in checkParentExistsOnChain is fork-safe: the restore path appends GenesisBlockID first, and genesis cannot fork. Looks identical at a glance to the index-[0] bugs surfaced in bsv-blockchain#963, but this site is safe by construction.
|
🤖 Claude Code Review Status: Complete Current Review: Analysis:
The expanded comment prevents future maintainers from incorrectly "fixing" this intentional pattern. |
|
ordishs
left a comment
There was a problem hiding this comment.
Targeted docs change; verified against cmd/seeder/seeder.go:557 (restore path appends BlockID: 0 first). Comment accurately captures the sentinel invariant that makes the BlockIDs[0] access fork-safe at this call site.



Closes #967.
Spells out the invariant that keeps the
BlockIDs[0] == GenesisBlockIDaccess incheckParentExistsOnChainfork-safe:GenesisBlockIDfirst.BlockIDs[0] == GenesisBlockIDuniquely identifies a restored tx.The site looks identical at a glance to the index-
[0]bugs surfaced in #963, but is safe by construction. The comment expansion stops a future reader from "fixing" it.No behavioural change.