Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop error result from Node.hashWithCount #757

Closed
elias-orijtech opened this issue May 3, 2023 · 1 comment · Fixed by #777
Closed

Drop error result from Node.hashWithCount #757

elias-orijtech opened this issue May 3, 2023 · 1 comment · Fixed by #777

Comments

@elias-orijtech
Copy link
Contributor

Node.hashWithCount can only return errors in two cases:

iavl/node.go

Lines 336 to 343 in 64ffc27

err := node.writeHashBytesRecursively(buf, version)
if err != nil {
return nil, err
}
_, err = h.Write(buf.Bytes())
if err != nil {
return nil, err
}

The first case is its own error result, recursively. The second one is the error result from hash.Hash.Write which is documented to never return an error.

CC @odeke-em

@tac0turtle
Copy link
Member

want to submit a pr?

elias-orijtech added a commit to elias-orijtech/iavl that referenced this issue May 24, 2023
There are no cases where Hash would fail, so don't return an error
value. Simplifies every caller, as can be seen from the test changes.

Fixes cosmos#757
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants