modified blockMinter.java to check for null peers (thanks @kennycud) #196
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change is to prevent NullPointerException and blockMinter thread crash.
The current theory is that nodes that have been running a long time have a higher likelihood of having a crashed blockMinter thread, thus preventing them from minting new blocks. Theory is that this is caused by nefarious nodes shutting their nodes down at the perfect time to allow a null peer to get into the peers list, and upon attempting to check for a higher weight block, a null pointer exception takes place, thus crashing the block minter.
When this happens, the block minter stays crashed, and doesn't fix itself.
We are looking into longer-term changes that will both more thoroughly handle the issue, and check the block minter for crashes and restart it, but for now this change should hopefully prevent a null peer from causing the null pointer, and thus prevent the block minter from crashing.
Thanks to @kennycud for the lesson and initially tracking down the issue!