Skip to content

Commit

Permalink
Handle errors with uninitialized DB
Browse files Browse the repository at this point in the history
  • Loading branch information
orogvany committed Mar 7, 2018
1 parent 0fbb22e commit 9b76e7a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/main/java/com/semuxpool/pool/PoolRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ public static void main(String[] args) throws IOException, SemuxException
poolAddresses.add(payQuitterAddress);
Integer minimumVoteAgeBeforeCounting = Integer.valueOf(properties.getProperty("minimumVoteAgeBeforeCounting", "200"));



PoolProfitAddresses poolProfitsAddress = PoolProfitAddresses.fromString(properties.getProperty("poolProfitsAddress"));


poolAddresses.addAll(poolProfitsAddress.getAddresses());
boolean submitToAggregationSite = Boolean.valueOf(properties.getProperty("submitToAggregationSite", "false"));
long startBlock = Long.valueOf(properties.getProperty("startProcessingAtBlock", "0"));
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/semuxpool/pool/api/BlockResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ public Map<String, Long> getPayouts()
*/
private Long getPartialReward(Long value)
{
if(totalVotes == 0)
{
return 0l;
}
BigInteger results = BigInteger.valueOf(getBlockReward()).multiply(BigInteger.valueOf(value)).divide(BigInteger.valueOf(totalVotes));
return results.longValue();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ else if (transaction.getType().equals("UNVOTE"))
currentVal = currentVal + valueToAdd;
if (currentVal < 0L)
{
logger.info("Negative vote amount from " + transaction.getFrom());
logger.info("Negative vote amount from " + transaction.getFrom() + ", votes = " + currentVal + ". This is normal when votes not yet vested are unvoted.");
currentVal = 0l;
}

Expand Down

0 comments on commit 9b76e7a

Please sign in to comment.