Skip to content

fix: remove redundant nil check and fix comment#4719

Closed
Bashmunta wants to merge 1 commit intocelestiaorg:mainfrom
Bashmunta:fix/ipld-remove-nil-check-and-doc
Closed

fix: remove redundant nil check and fix comment#4719
Bashmunta wants to merge 1 commit intocelestiaorg:mainfrom
Bashmunta:fix/ipld-remove-nil-check-and-doc

Conversation

@Bashmunta
Copy link
Copy Markdown

The nil-check for leaves in GetSharesByNamespace was unnecessary because CollectLeavesByNamespace returns an error on any retrieval failure, and the absent-namespace path exits before building shares. This could silently skip elements if retained. Also corrected the function comment to reflect actual behavior: errors short-circuit with no shares, while absent namespace returns no shares and a proof with err == nil.

@github-actions github-actions Bot added the external Issues created by non node team members label Nov 29, 2025
@vgonkivs
Copy link
Copy Markdown
Member

There it is — line 243: n.addLeaf(j.sharePos, nil). When GetNode fails, it adds a nil leaf to the namespace data. The error is stored via singleErr.Do but processing continues — other leaves may succeed.
Then at line 225, retrievalErr is returned but Leaves() still contains nil entries from failed retrievals. So the nil check in GetSharesByNamespace is not redundant — it protects against panicking on these nil leaves.

@vgonkivs vgonkivs closed this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external Issues created by non node team members

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants