Skip to content

Commit

Permalink
Update pool runner for upcoming halving
Browse files Browse the repository at this point in the history
  • Loading branch information
orogvany committed Dec 13, 2019
1 parent 043a187 commit 239a316
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.semuxpool</groupId>
<artifactId>semux-pool</artifactId>
<version>1.5.1-SNAPSHOT</version>
<version>1.6.0</version>
<packaging>jar</packaging>
<description>Semux pool</description>

Expand Down Expand Up @@ -163,7 +163,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.2</version>
<version>2.9.10.1</version>
</dependency>

<!-- Testing Libraries -->
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/com/semuxpool/pool/PoolRunner.java
Expand Up @@ -88,12 +88,10 @@ public static void main(String[] args) throws IOException, SemuxException {

//
// Try to look up block reward, else use defaults
long blockReward = 3 * Constants.SEM;
long fee = 5_000_000l;

try {
TransactionLimits transactionLimits = client.getTransactionLimits("TRANSFER");
blockReward = 3 * Constants.SEM;
fee = transactionLimits.getMinTransactionFee();
} catch (Exception e) {
//old API in use, just use defaults
Expand All @@ -103,8 +101,7 @@ public static void main(String[] args) throws IOException, SemuxException {
//persistence
Persistence persistence = new JsonPersistence(payoutsDirectory);
BlockResultFactory blockResultFactory = new BlockResultFactory(
client, poolPayoutPercent, developerBeerFundPercent,
blockReward, poolProfitsAddress, minimumVoteAgeBeforeCounting, voterWhitelist, voterBlacklist);
client, poolPayoutPercent, developerBeerFundPercent, poolProfitsAddress, minimumVoteAgeBeforeCounting, voterWhitelist, voterBlacklist);

//
//payer
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/com/semuxpool/pool/block/BlockResultFactory.java
Expand Up @@ -30,16 +30,14 @@ public class BlockResultFactory {
private final float donationPercent;
private final PoolProfitAddresses poolProfitsAddress;
private final Integer minimumVoteAgeBeforeCounting;
private final Long blockReward;
private Set<String> voterWhitelist = new HashSet<>();
private Set<String> voterBlacklist = new HashSet<>();
private Set<String> voterWhitelist;
private Set<String> voterBlacklist;

public BlockResultFactory(SemuxClient client, float poolPayoutPercent, float donationPercent, Long blockReward,
public BlockResultFactory(SemuxClient client, float poolPayoutPercent, float donationPercent,
PoolProfitAddresses poolProfitsAddress, Integer minimumVoteAgeBeforeCounting,
Set<String> voterWhitelist, Set<String> voterBlacklist) {
this.client = client;
this.poolPayoutPercent = poolPayoutPercent;
this.blockReward = blockReward;
this.donationPercent = donationPercent;
this.poolProfitsAddress = poolProfitsAddress;
this.minimumVoteAgeBeforeCounting = minimumVoteAgeBeforeCounting;
Expand Down Expand Up @@ -202,8 +200,12 @@ private Map<String, Long> getAgedVotesForBlock(Block block) throws IOException,
}

private Long getReward(Block block) {
Long total = blockReward;
Long total = 0l;
for (Transaction transaction : block.getTransactions()) {
if (transaction.getType().equalsIgnoreCase("COINBASE"))
{
total += transaction.getValue();
}
total += transaction.getFee();
}
return total;
Expand Down

0 comments on commit 239a316

Please sign in to comment.