Unit tests for the Blockstore#1129
Conversation
| Block[] blockFamily = new Block[] { null, null, null}; | ||
| if (hash == null) { | ||
| return null; | ||
| return blockFamily; |
There was a problem hiding this comment.
I think this change will let AionBlockChainImpl.isValid() throw null exception. Please have a check.
There was a problem hiding this comment.
I updated the null check in AionBlockchainImpl.isValid to exit if the parent block is null.
| Block[] blockFamily = new Block[] { null, null}; | ||
| if (hash == null) { | ||
| return null; | ||
| return blockFamily; |
There was a problem hiding this comment.
Will let AionBlockChainImpl.createNewMiningBlockInternal() throw NPE
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Ok. I made the update.
ac137bc to
3cdd7e3
Compare
The method was incorrectly returning all blocks flagged as main chain.
3cdd7e3 to
5fb5e03
Compare
Type of change