chore: move initGenesisChunks call into GetGenesisChunks#473
chore: move initGenesisChunks call into GetGenesisChunks#473tzdybal merged 3 commits intoevstack:mainfrom
Conversation
|
Error should be propagated to |
Codecov Report
@@ Coverage Diff @@
## main #473 +/- ##
==========================================
- Coverage 55.17% 55.15% -0.02%
==========================================
Files 48 48
Lines 8799 8802 +3
==========================================
Hits 4855 4855
- Misses 3191 3193 +2
- Partials 753 754 +1
Help us with your feedback. Take ten seconds to tell us how you rate us. |
adlerjohn
left a comment
There was a problem hiding this comment.
Can the documentation around the three affected functions be improved here? It's not obvious to be how they differ:
- returns chunked version of genesis.
- returns given chunk of genesis.
You really wouldn't be able to tell these two descriptions apart were it not for the parameter, but what the functions do is completely different. What are their assumptions around initialization, what are they parameters and return values, etc.
| return n.genChunks | ||
| func (n *Node) GetGenesisChunks() ([]string, error) { | ||
| err := n.initGenesisChunks() | ||
| return n.genChunks, err |
There was a problem hiding this comment.
Stylistic nit, but would prefer explicitly handling the error case here.
There was a problem hiding this comment.
Ok, @tzdybal prefers the other way - which way should I take?
There was a problem hiding this comment.
Or did I misunderstand something about how the error should be handled 😅
There was a problem hiding this comment.
Oh I meant instead of returning return n.genChunks, err, return return n.genChunks, nil and do an explicit
if err != nil {
return nil, err
}before that.
df50bb3 to
9550cf2
Compare
Resolves #470 (I think?)
Should the error handling from
initGenesisChunksbe kept insideGetGenesisChunks, or be passed toGenesisChunked?