-
Notifications
You must be signed in to change notification settings - Fork 80
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
fix: return 0 height inside GetLastBlockHeight if there are no blocks #76
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this change honestly. Wouldn't it make more sense to have the GetLastBlockHeight
method return maybe 0
instead of an error if there are no blocks? I mean, if there are no blocks stored inside the database, 0
makes sense as the last block height (since blocks start from 1
and 0
means no blocks).
cool I changed the |
return err
with log.Error()
for GetLastBlockHeight()
in parse blocks cmdGetLastBlockHeight()
method while no block is saved
GetLastBlockHeight()
method while no block is savedGetLastBlockHeight()
if there are no blocks
GetLastBlockHeight()
if there are no blocks…e no blocks" (#78) ## Description fix #76 I forgot to remove this section of codes lol ## Checklist - [ ] Targeted PR against correct branch. - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [ ] Wrote unit tests. - [ ] Re-reviewed `Files changed` in the Github PR explorer.
…#76) When we use the parse blocks command, in case that the database is empty, `return err` here will error out the program and not continuing parsing the desired block height. Replacing it here so it's more handy for dev purpose when we need to just test specific heights. (we don't have to run ` start cmd` before using `parse blocks all`) - [x] Targeted PR against correct branch. - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [ ] Wrote unit tests. - [x] Re-reviewed `Files changed` in the Github PR explorer.
…e no blocks" (#78) ## Description fix #76 I forgot to remove this section of codes lol ## Checklist - [ ] Targeted PR against correct branch. - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [ ] Wrote unit tests. - [ ] Re-reviewed `Files changed` in the Github PR explorer.
…#76) When we use the parse blocks command, in case that the database is empty, `return err` here will error out the program and not continuing parsing the desired block height. Replacing it here so it's more handy for dev purpose when we need to just test specific heights. (we don't have to run ` start cmd` before using `parse blocks all`) - [x] Targeted PR against correct branch. - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [ ] Wrote unit tests. - [x] Re-reviewed `Files changed` in the Github PR explorer.
…e no blocks" (#78) ## Description fix #76 I forgot to remove this section of codes lol ## Checklist - [ ] Targeted PR against correct branch. - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. - [ ] Wrote unit tests. - [ ] Re-reviewed `Files changed` in the Github PR explorer.
Description
When we use the parse blocks command, in case that the database is empty,
return err
here will error out the program and not continuing parsing the desired block height. Replacing it here so it's more handy for dev purpose when we need to just test specific heights. (we don't have to runstart cmd
before usingparse blocks all
)Checklist
Files changed
in the Github PR explorer.