Skip to content

opt(common): GenesisBlock timestamp valid message error #6295

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

imalasong
Copy link
Contributor

What does this PR do?

message error

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

try {
long l = Long.parseLong(this.timestamp);
if (l < 0) {
} else {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changed the original logic. What if the passed timestamp = ""? The changed logic will not catch this error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the code for catch still exists

The core issue to be addressed in this pull request (PR) is that when a user enters a negative number, an error message is displayed: " Timestamp must be a Long type.", which is incorrect.
It should be changed to: "Timestamp must be greater than or equal to 0.";

Then I optimized the code a bit further. When this.timestamp == null, DEFAULT_TIMESTAMP will be set, and I believe there's no need to execute the following verification logic

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the function params timestamp = "" not null, how the new logic catch it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
The complete code length is like this, and it seems that browsing GitHub's code cannot clearly see the modified code

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 this pull request may close these issues.

2 participants