Skip to content

Unit tests for the Blockstore#1129

Merged
AlexandraRoatis merged 4 commits intomasterfrom
AKI-657
Mar 13, 2020
Merged

Unit tests for the Blockstore#1129
AlexandraRoatis merged 4 commits intomasterfrom
AKI-657

Conversation

@AlexandraRoatis
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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