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

Unit tests for the Blockstore #1129

Merged
merged 4 commits into from
Mar 13, 2020
Merged

Unit tests for the Blockstore #1129

merged 4 commits into from
Mar 13, 2020

Conversation

AlexandraRoatis
Copy link
Contributor

Type of change

  • Bug fix.
  • New feature.
  • Enhancement.
  • Unit test.
  • Breaking change (a fix or feature that causes existing functionality to not work as expected).
  • Requires documentation update.

@AlexandraRoatis AlexandraRoatis added bug Something isn't working enhancement New feature or request labels Mar 11, 2020
@AlexandraRoatis AlexandraRoatis added this to the 1.5 milestone Mar 11, 2020
@AlexandraRoatis AlexandraRoatis self-assigned this Mar 11, 2020
if (hash == null) {
return null;
return blockFamily;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this change will let AionBlockChainImpl.isValid() throw null exception. Please have a check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the null check in AionBlockchainImpl.isValid to exit if the parent block is null.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cool.

if (hash == null) {
return null;
return blockFamily;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will let AionBlockChainImpl.createNewMiningBlockInternal() throw NPE

Copy link
Contributor Author

@AlexandraRoatis AlexandraRoatis Mar 12, 2020

Choose a reason for hiding this comment

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

It would already throw an NPE because the blockFamily is accessed without a null check. The reason for the NPE differs but it will be thown in either case. If that happens I think we should allows the failure and fix the cause when we find one.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So We should just throw NPE if the input hash equal to null. instead of return values (or return null)

Same as the other method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I made the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants