Skip to content

Commit

Permalink
Trivial: Fix possible NPE, typo
Browse files Browse the repository at this point in the history
fix NPE
fix typo
and filter payouts to exclude other files
  • Loading branch information
chris.orogvany committed Mar 29, 2018
1 parent 1430200 commit 3283b61
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/semuxpool/pool/Pool.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private boolean shouldPay(long currentBlock, boolean isSynced)
{
if (isSynced)
{
logger.info("Time is pays " + payoutTime + ", time to pay!");
logger.info("Time is " + payoutTime + ", time to pay!");
}
return isSynced;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ public BlockResult getBlockResult(Block block) throws IOException, SemuxExceptio
Long poolPayout = 0l;
for (String profitAddress : poolProfitsAddress.getAddresses())
{
poolPayout += result.getPayouts().get(profitAddress);
if(result.getPayouts() != null && result.getPayouts().get(profitAddress) != null)
{
poolPayout += result.getPayouts().get(profitAddress);
}
}
logger.trace("Pool profits: " + poolPayout);
float totalPercent = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ public List<Payout> getAllPayouts() throws IOException
List<Payout> payouts = new ArrayList<>();
for (String fileName : payoutFileNames)
{
logger.debug("Checking file " + fileName);
if(!fileName.endsWith(".json"))
{
continue;
}
logger.info("Checking file " + fileName);
//look for last one not paid out
File file = new File(fileName);
Payout payout = mapper.readValue(file, Payout.class);
Expand Down

0 comments on commit 3283b61

Please sign in to comment.