Skip to content

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
Block[] blockFamily = new Block[] { null, null, null};
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.

Block[] blockFamily = new Block[] { null, null};
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.

3 participants