diff --git a/jminer.default.properties b/jminer.default.properties
index 417233d..67b108f 100644
--- a/jminer.default.properties
+++ b/jminer.default.properties
@@ -97,9 +97,6 @@ winnerRetryIntervalInMs=
devPool=
devPoolCommitsPerRound=
-# NOT WORKING?! Try, but i fear it will find no deadlines, yet.
-optDevPool=false
-
# -----------------------------------------------------------------------------------
# - MINING MODE - SOLO ---------------------------------- ONLY NEEDED 4 SOLO MINING -
# -----------------------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a9958aa..794cf50 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
burstcoin
burstcoin-jminer
- 0.4.6-SNAPSHOT
+ 0.4.7-SNAPSHOT
jar
burstcoin-jminer
diff --git a/run.bat b/run.bat
index 684b708..eba6391 100644
--- a/run.bat
+++ b/run.bat
@@ -1 +1 @@
-java -jar -d64 -XX:+UseG1GC burstcoin-jminer-0.4.6-SNAPSHOT.jar
\ No newline at end of file
+java -jar -d64 -XX:+UseG1GC burstcoin-jminer-0.4.7-SNAPSHOT.jar
\ No newline at end of file
diff --git a/src/main/java/burstcoin/jminer/JMinerCommandLine.java b/src/main/java/burstcoin/jminer/JMinerCommandLine.java
index 3ce5c81..2624f90 100644
--- a/src/main/java/burstcoin/jminer/JMinerCommandLine.java
+++ b/src/main/java/burstcoin/jminer/JMinerCommandLine.java
@@ -85,7 +85,7 @@ public void run(String... args)
LOG.info(" __ __ GPU assisted PoC-Miner");
LOG.info(" |__| _____ |__| ____ ___________ ");
LOG.info(" version | |/ \\| |/ \\_/ __ \\_ __ \\");
- LOG.info(" 0.4.6 | | Y Y \\ | | \\ ___/| | \\/");
+ LOG.info(" 0.4.7 | | Y Y \\ | | \\ ___/| | \\/");
LOG.info(" /\\__| |__|_| /__|___| /\\___ >__| ");
LOG.info(" \\______| \\/ \\/ \\/");
LOG.info(" mining engine: BURST-LUXE-RED2-G6JW-H4HG5");
@@ -193,9 +193,6 @@ public void onApplicationEvent(ReaderProgressChangedEvent event)
{
progressLogStep--;
- // trigger garbage collection on every progress step
- System.gc();
-
BigDecimal totalCapacity = new BigDecimal(event.getCapacity());
BigDecimal factor = BigDecimal.ONE.divide(totalCapacity, MathContext.DECIMAL32);
BigDecimal progress = factor.multiply(new BigDecimal(event.getCapacity() - event.getRemainingCapacity()));
diff --git a/src/main/java/burstcoin/jminer/core/CoreProperties.java b/src/main/java/burstcoin/jminer/core/CoreProperties.java
index a39715e..ddcb29e 100644
--- a/src/main/java/burstcoin/jminer/core/CoreProperties.java
+++ b/src/main/java/burstcoin/jminer/core/CoreProperties.java
@@ -66,10 +66,6 @@ public class CoreProperties
private static final boolean DEFAULT_WRITE_LOG_FILE = false;
private static final String DEFAULT_LOG_FILE_PATH = "log/jminer.log.txt";
- // there seams to be a issue on checker
- private static final boolean DEFAULT_OPT_DEV_POOL = false;
-
-
static
{
try
@@ -89,7 +85,6 @@ public class CoreProperties
private static Long winnerRetryIntervalInMs;
private static Boolean scanPathsEveryRound;
private static Integer devPoolCommitsPerRound;
- private static Boolean optDevPool;
private static Boolean devPool;
private static Boolean poolMining;
private static Long targetDeadline;
@@ -214,20 +209,6 @@ public static int getDevPoolCommitsPerRound()
return devPoolCommitsPerRound;
}
- /**
- * Is opt dev pool.
- *
- * @return the boolean
- */
- public static boolean isOptDevPool()
- {
- if(optDevPool == null)
- {
- optDevPool = asBoolean("optDevPool", DEFAULT_OPT_DEV_POOL);
- }
- return optDevPool;
- }
-
/**
* Is dev pool.
*
diff --git a/src/main/java/burstcoin/jminer/core/checker/Checker.java b/src/main/java/burstcoin/jminer/core/checker/Checker.java
index 7607d8a..330a18a 100644
--- a/src/main/java/burstcoin/jminer/core/checker/Checker.java
+++ b/src/main/java/burstcoin/jminer/core/checker/Checker.java
@@ -22,8 +22,6 @@
package burstcoin.jminer.core.checker;
-import burstcoin.jminer.core.CoreProperties;
-import burstcoin.jminer.core.checker.task.OCLCheckerFindAllBelowTargetTask;
import burstcoin.jminer.core.checker.task.OCLCheckerTask;
import burstcoin.jminer.core.reader.event.ReaderLoadedPartEvent;
import org.slf4j.Logger;
@@ -35,8 +33,6 @@
import org.springframework.core.task.SyncTaskExecutor;
import org.springframework.stereotype.Component;
-import javax.annotation.PostConstruct;
-
/**
* The type Checker.
*/
@@ -47,46 +43,23 @@ public class Checker
{
private static final Logger LOG = LoggerFactory.getLogger(Checker.class);
- @Autowired
- private ApplicationContext context;
-
- @Autowired
- private SyncTaskExecutor checkTaskExecutor;
-
- // setting
- private boolean devPool;
- private boolean optDevPool;
+ private final ApplicationContext context;
+ private final SyncTaskExecutor checkTaskExecutor;
// data
private long blockNumber;
- private long targetDeadline;
- private long baseTarget;
private byte[] generationSignature;
- /**
- * Post construct.
- */
- @PostConstruct
- protected void postConstruct()
+ @Autowired
+ public Checker(ApplicationContext context, SyncTaskExecutor checkTaskExecutor)
{
- this.devPool = CoreProperties.isDevPool();
- this.optDevPool = CoreProperties.isOptDevPool();
- this.targetDeadline = CoreProperties.getTargetDeadline();
+ this.context = context;
+ this.checkTaskExecutor = checkTaskExecutor;
}
- /**
- * Reconfigure void.
- *
- * @param blockNumber the block number
- * @param baseTarget the base target
- * @param targetDeadline the target deadline
- * @param generationSignature the generation signature
- */
- public void reconfigure(long blockNumber, long baseTarget, long targetDeadline, byte[] generationSignature)
+ public void reconfigure(long blockNumber, byte[] generationSignature)
{
this.blockNumber = blockNumber;
- this.baseTarget = baseTarget;
- this.targetDeadline = targetDeadline;
this.generationSignature = generationSignature;
}
@@ -96,20 +69,9 @@ public void handleMessage(ReaderLoadedPartEvent event)
{
if(blockNumber == event.getBlockNumber())
{
- if(devPool && optDevPool)
- {
- // todo findTartget() does not work! optDevPool not supported yet!
- OCLCheckerFindAllBelowTargetTask oclCheckerFindAllBelowTargetTask = context.getBean(OCLCheckerFindAllBelowTargetTask.class);
- oclCheckerFindAllBelowTargetTask.init(event.getBlockNumber(), generationSignature, event.getScoops(), targetDeadline,
- event.getChunkPartStartNonce(), baseTarget);
- checkTaskExecutor.execute(oclCheckerFindAllBelowTargetTask);
- }
- else
- {
- OCLCheckerTask oclCheckerTask = context.getBean(OCLCheckerTask.class);
- oclCheckerTask.init(event.getBlockNumber(), generationSignature, event.getScoops(), event.getChunkPartStartNonce());
- checkTaskExecutor.execute(oclCheckerTask);
- }
+ OCLCheckerTask oclCheckerTask = context.getBean(OCLCheckerTask.class);
+ oclCheckerTask.init(event.getBlockNumber(), generationSignature, event.getScoops(), event.getChunkPartStartNonce());
+ checkTaskExecutor.execute(oclCheckerTask);
}
else
{
diff --git a/src/main/java/burstcoin/jminer/core/checker/event/CheckerDevResultEvent.java b/src/main/java/burstcoin/jminer/core/checker/event/CheckerDevResultEvent.java
deleted file mode 100644
index 5234fd2..0000000
--- a/src/main/java/burstcoin/jminer/core/checker/event/CheckerDevResultEvent.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 by luxe - https://github.com/de-luxe - BURST-LUXE-RED2-G6JW-H4HG5
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute,
- * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies
- * or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package burstcoin.jminer.core.checker.event;
-
-import burstcoin.jminer.core.network.model.DevPoolResult;
-
-import java.math.BigInteger;
-import java.util.List;
-
-/**
- * fired on devPoolOpt instead of CheckerResultEvent
- */
-public class CheckerDevResultEvent
-{
- private BigInteger chunkPartStartNonce;
- private long blockNumber;
-
- private List devPoolResults;
-
- /**
- * Instantiates a new Checker dev result event.
- *
- * @param blockNumber the block number
- * @param chunkPartStartNonce the chunk part start nonce
- * @param devPoolResults the dev pool results
- */
- public CheckerDevResultEvent(long blockNumber, BigInteger chunkPartStartNonce, List devPoolResults)
- {
- this.chunkPartStartNonce = chunkPartStartNonce;
-
- this.blockNumber = blockNumber;
- this.devPoolResults = devPoolResults;
- }
-
- /**
- * Gets block number.
- *
- * @return the block number
- */
- public long getBlockNumber()
- {
- return blockNumber;
- }
-
- /**
- * Gets chunk part start nonce.
- *
- * @return the chunk part start nonce
- */
- public BigInteger getChunkPartStartNonce()
- {
- return chunkPartStartNonce;
- }
-
- /**
- * Gets dev pool results.
- *
- * @return the dev pool results
- */
- public List getDevPoolResults()
- {
- return devPoolResults;
- }
-
- /**
- * Has results.
- *
- * @return the boolean
- */
- public boolean hasResults()
- {
- return devPoolResults != null && !devPoolResults.isEmpty();
- }
-}
diff --git a/src/main/java/burstcoin/jminer/core/checker/event/CheckerResultEvent.java b/src/main/java/burstcoin/jminer/core/checker/event/CheckerResultEvent.java
index 468e329..911f237 100644
--- a/src/main/java/burstcoin/jminer/core/checker/event/CheckerResultEvent.java
+++ b/src/main/java/burstcoin/jminer/core/checker/event/CheckerResultEvent.java
@@ -35,14 +35,6 @@ public class CheckerResultEvent
private BigInteger nonce;
private BigInteger result;
- /**
- * Instantiates a new Checker result event.
- *
- * @param blockNumber the block number
- * @param chunkPartStartNonce the chunk part start nonce
- * @param nonce the nonce
- * @param result the result
- */
public CheckerResultEvent(long blockNumber, BigInteger chunkPartStartNonce, BigInteger nonce, BigInteger result)
{
this.chunkPartStartNonce = chunkPartStartNonce;
@@ -52,41 +44,21 @@ public CheckerResultEvent(long blockNumber, BigInteger chunkPartStartNonce, BigI
this.result = result;
}
- /**
- * Gets block number.
- *
- * @return the block number
- */
public long getBlockNumber()
{
return blockNumber;
}
- /**
- * Gets nonce.
- *
- * @return the nonce
- */
public BigInteger getNonce()
{
return nonce;
}
- /**
- * Gets result.
- *
- * @return the result
- */
public BigInteger getResult()
{
return result;
}
- /**
- * Gets chunk part start nonce.
- *
- * @return the chunk part start nonce
- */
public BigInteger getChunkPartStartNonce()
{
return chunkPartStartNonce;
diff --git a/src/main/java/burstcoin/jminer/core/checker/task/OCLCheckerFindAllBelowTargetTask.java b/src/main/java/burstcoin/jminer/core/checker/task/OCLCheckerFindAllBelowTargetTask.java
deleted file mode 100644
index c886ac4..0000000
--- a/src/main/java/burstcoin/jminer/core/checker/task/OCLCheckerFindAllBelowTargetTask.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2016 by luxe - https://github.com/de-luxe - BURST-LUXE-RED2-G6JW-H4HG5
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- * and associated documentation files (the "Software"), to deal in the Software without restriction,
- * including without limitation the rights to use, copy, modify, merge, publish, distribute,
- * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
- * is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies
- * or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-package burstcoin.jminer.core.checker.task;
-
-import burstcoin.jminer.core.checker.event.CheckerDevResultEvent;
-import burstcoin.jminer.core.checker.util.OCLChecker;
-import burstcoin.jminer.core.network.model.DevPoolResult;
-import fr.cryptohash.Shabal256;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-import pocminer.generate.MiningPlot;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * The type OCL checker find all below target task.
- */
-@Component
-@Scope("prototype")
-public class OCLCheckerFindAllBelowTargetTask
- implements Runnable
-{
- private static final Logger LOG = LoggerFactory.getLogger(OCLCheckerFindAllBelowTargetTask.class);
-
- @Autowired
- private ApplicationEventPublisher publisher;
-
- private final OCLChecker oclChecker;
-
- private long blockNumber;
- private byte[] generationSignature;
- private byte[] scoops;
- private BigInteger chunkPartStartNonce;
- private long targetDeadline;
- private long baseTarget;
-
- /**
- * Instantiates a new OCL checker find all below target task.
- *
- * @param oclChecker the ocl checker
- */
- @Autowired
- public OCLCheckerFindAllBelowTargetTask(OCLChecker oclChecker)
- {
- this.oclChecker = oclChecker;
- }
-
- /**
- * Init void.
- *
- * @param blockNumber the block number
- * @param generationSignature the generation signature
- * @param scoops the scoops
- * @param targetDeadline the target deadline
- * @param chunkPartStartNonce the chunk part start nonce
- * @param baseTarget the base target
- */
- public void init(long blockNumber, byte[] generationSignature, byte[] scoops, long targetDeadline, BigInteger chunkPartStartNonce, long baseTarget)
- {
- this.blockNumber = blockNumber;
- this.generationSignature = generationSignature;
- this.scoops = scoops;
- this.targetDeadline = targetDeadline;
- this.chunkPartStartNonce = chunkPartStartNonce;
- this.baseTarget = baseTarget;
- }
-
- @Override
- public void run()
- {
- int[] lowestNonces;
- synchronized(oclChecker)
- {
- // todo not working?!
- lowestNonces = oclChecker.findTarget(generationSignature, scoops, targetDeadline);
- }
-
- if(lowestNonces != null)
- {
- List devPoolResults = new ArrayList<>();
- for(int lowestNonce : lowestNonces)
- {
- BigInteger nonce = chunkPartStartNonce.add(BigInteger.valueOf(lowestNonce));
- BigInteger result = calculateResult(scoops, generationSignature, lowestNonce);
- BigInteger deadline = result.divide(BigInteger.valueOf(baseTarget));
- long calculatedDeadline = deadline.longValue();
-
- devPoolResults.add(new DevPoolResult(blockNumber, calculatedDeadline, nonce, chunkPartStartNonce));
- }
- publisher.publishEvent(new CheckerDevResultEvent(blockNumber, chunkPartStartNonce, devPoolResults));
- }
- else
- {
- publisher.publishEvent(new CheckerDevResultEvent(blockNumber, chunkPartStartNonce, null));
- }
- }
-
- private BigInteger calculateResult(byte[] scoops, byte[] generationSignature, int nonce)
- {
- Shabal256 md = new Shabal256();
- md.reset();
- md.update(generationSignature);
- md.update(scoops, nonce * MiningPlot.SCOOP_SIZE, MiningPlot.SCOOP_SIZE);
- byte[] hash = md.digest();
- return new BigInteger(1, new byte[]{hash[7], hash[6], hash[5], hash[4], hash[3], hash[2], hash[1], hash[0]});
- }
-}
diff --git a/src/main/java/burstcoin/jminer/core/checker/task/OCLCheckerTask.java b/src/main/java/burstcoin/jminer/core/checker/task/OCLCheckerTask.java
index 83d9cf2..c401b6c 100644
--- a/src/main/java/burstcoin/jminer/core/checker/task/OCLCheckerTask.java
+++ b/src/main/java/burstcoin/jminer/core/checker/task/OCLCheckerTask.java
@@ -36,10 +36,6 @@
import java.math.BigInteger;
-
-/**
- * The type OCL checker task.
- */
@Component
@Scope("prototype")
public class OCLCheckerTask
@@ -47,9 +43,7 @@ public class OCLCheckerTask
{
private static final Logger LOG = LoggerFactory.getLogger(OCLCheckerTask.class);
- @Autowired
- private ApplicationEventPublisher publisher;
-
+ private final ApplicationEventPublisher publisher;
private final OCLChecker oclChecker;
private long blockNumber;
@@ -57,25 +51,13 @@ public class OCLCheckerTask
private byte[] scoops;
private BigInteger chunkPartStartNonce;
- /**
- * Instantiates a new OCL checker task.
- *
- * @param oclChecker the ocl checker
- */
@Autowired
- public OCLCheckerTask(OCLChecker oclChecker)
+ public OCLCheckerTask(OCLChecker oclChecker, ApplicationEventPublisher publisher)
{
this.oclChecker = oclChecker;
+ this.publisher = publisher;
}
- /**
- * Init void.
- *
- * @param blockNumber the block number
- * @param generationSignature the generation signature
- * @param scoops the scoops
- * @param chunkPartStartNonce the chunk part start nonce
- */
public void init(long blockNumber, byte[] generationSignature, byte[] scoops, BigInteger chunkPartStartNonce)
{
this.blockNumber = blockNumber;
diff --git a/src/main/java/burstcoin/jminer/core/checker/util/OCLChecker.java b/src/main/java/burstcoin/jminer/core/checker/util/OCLChecker.java
index d484dba..8aef18a 100644
--- a/src/main/java/burstcoin/jminer/core/checker/util/OCLChecker.java
+++ b/src/main/java/burstcoin/jminer/core/checker/util/OCLChecker.java
@@ -61,20 +61,16 @@ public class OCLChecker
private static final Logger LOG = LoggerFactory.getLogger(OCLChecker.class);
private static final int SIZE_DIVISOR = CoreProperties.isByteUnitDecimal() ? 1000 : 1024;
- private static final String T_UNIT = CoreProperties.isByteUnitDecimal() ? "TB" : "TiB";
private static final String G_UNIT = CoreProperties.isByteUnitDecimal() ? "GB" : "GiB";
- private static final String M_UNIT = CoreProperties.isByteUnitDecimal() ? "MB" : "MiB";
- cl_context context;
- cl_command_queue queue;
- cl_program program;
- cl_kernel kernel[] = new cl_kernel[3];
+ private cl_context context;
+ private cl_command_queue queue;
- long workgroupSize[] = new long[3];
- long computeUnits;
+ private cl_kernel kernel[] = new cl_kernel[2];
+ private long workgroupSize[] = new long[2];
- cl_mem gensigMem;
- cl_mem bestMem;
+ private cl_mem gensigMem;
+ private cl_mem bestMem;
@PostConstruct
protected void postConstruct()
@@ -128,15 +124,14 @@ public void initChecker(int platformId, int deviceId)
throw new RuntimeException("Failed to read calcdeadlines.cl file", e);
}
- program = clCreateProgramWithSource(context, 1, new String[]{kernelSource}, null, null);
+ cl_program program = clCreateProgramWithSource(context, 1, new String[]{kernelSource}, null, null);
clBuildProgram(program, 0, null, "-I kernel", null, null);
kernel[0] = clCreateKernel(program, "calculate_deadlines", null);
kernel[1] = clCreateKernel(program, "reduce_best", null);
- kernel[2] = clCreateKernel(program, "reduce_target", null);
long[] maxWorkGroupSize = new long[1];
- for(int i = 0; i < 3; i++)
+ for(int i = 0; i < 2; i++)
{
clGetKernelWorkGroupInfo(kernel[i], devices[deviceId], CL_KERNEL_WORK_GROUP_SIZE, 8, Pointer.to(maxWorkGroupSize), null);
workgroupSize[i] = maxWorkGroupSize[0];
@@ -145,7 +140,6 @@ public void initChecker(int platformId, int deviceId)
long[] maxComputeUnits = new long[1];
clGetDeviceInfo(devices[deviceId], CL_DEVICE_MAX_COMPUTE_UNITS, 8, Pointer.to(maxComputeUnits), null);
- computeUnits = maxComputeUnits[0];
gensigMem = clCreateBuffer(context, CL_MEM_READ_ONLY, 32, null, null);
bestMem = clCreateBuffer(context, CL_MEM_WRITE_ONLY, 400, null, null); // org 400 // tested 5000
@@ -178,7 +172,7 @@ private void check()
selectionPrefix = currentDeviceId == CoreProperties.getDeviceId() ? selector : " ";
LOG.info(selectionPrefix + " DEVICE-[" + currentDeviceId + "] " + DeviceInfos.getName(cl_device_id) + " "
- + "(" + bytesAsGigabyte(DeviceInfos.getMaxMemAllocSize(cl_device_id)) + ")"
+ + "(" + bytesAsGigabyte(DeviceInfos.getGlobalMemSize(cl_device_id)) + ")"
+ " - " + DeviceInfos.getVendor(cl_device_id) + " (" + DeviceInfos.getDeviceVersion(cl_device_id)
+ " | '" + DeviceInfos.getDriverVersion(cl_device_id) + "')");
LOG.info(selectionPrefix + " [" + currentDeviceId + "] "
@@ -203,8 +197,7 @@ private String bytesAsGigabyte(long bytes)
public int findLowest(byte[] gensig, byte[] data)
{
- cl_mem dataMem;
- cl_mem deadlineMem;
+ cl_mem dataMem, deadlineMem;
long numNonces = data.length / 64;
long calcWorkgroups = numNonces / workgroupSize[0];
@@ -235,44 +228,6 @@ public int findLowest(byte[] gensig, byte[] data)
return best[0];
}
- public int[] findTarget(byte[] gensig, byte[] data, long target)
- {
- long numNonces = data.length / 64;
- long calcWorkgroups = numNonces / workgroupSize[0];
- // thx blago
- if(numNonces % workgroupSize[0] != 0) // org. if(numNonces % 64 != 0)
- {
- calcWorkgroups++;
- }
- clEnqueueWriteBuffer(queue, gensigMem, false, 0, 32, Pointer.to(gensig), 0, null, null);
- cl_mem dataMem = clCreateBuffer(context, CL_MEM_READ_ONLY, calcWorkgroups * workgroupSize[0] * 64, null, null);
- clEnqueueWriteBuffer(queue, dataMem, false, 0, data.length, Pointer.to(data), 0, null, null);
- cl_mem deadlineMem = clCreateBuffer(context, CL_MEM_READ_WRITE, calcWorkgroups * workgroupSize[0] * 8, null, null);
- clSetKernelArg(kernel[0], 0, Sizeof.cl_mem, Pointer.to(gensigMem));
- clSetKernelArg(kernel[0], 1, Sizeof.cl_mem, Pointer.to(dataMem));
- clSetKernelArg(kernel[0], 2, Sizeof.cl_mem, Pointer.to(deadlineMem));
- clEnqueueNDRangeKernel(queue, kernel[0], 1, null, new long[]{calcWorkgroups * workgroupSize[0]}, new long[]{workgroupSize[0]}, 0, null, null);
- int best[] = new int[]{0};
- clEnqueueWriteBuffer(queue, bestMem, false, 0, 4, Pointer.to(best), 0, null, null);
- clSetKernelArg(kernel[2], 0, Sizeof.cl_mem, Pointer.to(deadlineMem));
- long len[] = {data.length / 64};
- clSetKernelArg(kernel[2], 1, Sizeof.cl_uint, Pointer.to(len));
- long targetPtr[] = new long[]{target};
- clSetKernelArg(kernel[2], 2, Sizeof.cl_ulong, Pointer.to(targetPtr));
- clSetKernelArg(kernel[2], 3, Sizeof.cl_mem, Pointer.to(bestMem));
- clEnqueueNDRangeKernel(queue, kernel[2], 1, null, new long[]{workgroupSize[2]}, new long[]{workgroupSize[2]}, 0, null, null);
- clEnqueueReadBuffer(queue, bestMem, true, 0, 4, Pointer.to(best), 0, null, null);
- if(best[0] == 0)
- {
- return null;
- }
- int bestVals[] = new int[best[0]];
- clEnqueueReadBuffer(queue, bestMem, true, 4, 4 * best[0], Pointer.to(bestVals), 0, null, null);
- clReleaseMemObject(dataMem);
- clReleaseMemObject(deadlineMem);
- return bestVals;
- }
-
public static String readInputStreamAsString(InputStream in)
throws IOException
{
diff --git a/src/main/java/burstcoin/jminer/core/checker/util/calcdeadlines.cl b/src/main/java/burstcoin/jminer/core/checker/util/calcdeadlines.cl
index 69bdae8..d015494 100644
--- a/src/main/java/burstcoin/jminer/core/checker/util/calcdeadlines.cl
+++ b/src/main/java/burstcoin/jminer/core/checker/util/calcdeadlines.cl
@@ -503,16 +503,3 @@ __kernel void reduce_best(__global unsigned long* deadlines, unsigned int length
best[get_group_id(0)] = best_pos[0];
}
}
-
-__kernel void reduce_target(__global unsigned long* deadlines, unsigned int length, unsigned long target, __global unsigned int* results) {
- int gid = get_global_id(0);
- int gsize = get_global_size(0);
-
- for(int i = gid; i < length; i += gsize) {
- unsigned long d = deadlines[i];
- if(d < target) {
- int index = atomic_inc(results) + 1;
- results[index] = i;
- }
- }
-}
diff --git a/src/main/java/burstcoin/jminer/core/network/task/NetworkSubmitPoolNonceTask.java b/src/main/java/burstcoin/jminer/core/network/task/NetworkSubmitPoolNonceTask.java
index b7b38f5..63dad8a 100644
--- a/src/main/java/burstcoin/jminer/core/network/task/NetworkSubmitPoolNonceTask.java
+++ b/src/main/java/burstcoin/jminer/core/network/task/NetworkSubmitPoolNonceTask.java
@@ -53,7 +53,7 @@ public class NetworkSubmitPoolNonceTask
implements Runnable
{
private static final Logger LOG = LoggerFactory.getLogger(NetworkSubmitPoolNonceTask.class);
- private static final String HEADER_MINER_NAME = "burstcoin-jminer-0.4.6";
+ private static final String HEADER_MINER_NAME = "burstcoin-jminer-0.4.7";
@Autowired
private ApplicationEventPublisher publisher;
diff --git a/src/main/java/burstcoin/jminer/core/reader/data/PlotDrive.java b/src/main/java/burstcoin/jminer/core/reader/data/PlotDrive.java
index 0b5069a..e1c6c91 100644
--- a/src/main/java/burstcoin/jminer/core/reader/data/PlotDrive.java
+++ b/src/main/java/burstcoin/jminer/core/reader/data/PlotDrive.java
@@ -62,7 +62,7 @@ public PlotDrive(String directory, Collection plotFilePaths, Long chunkPar
if(plotFile.getStaggeramt() % plotFile.getNumberOfParts() != 0)
{
- LOG.warn("could not calculate valid numberOfParts: " + plotFile.getFilePath());
+ LOG.error("could not calculate valid numberOfParts: " + plotFile.getFilePath());
}
}
}
@@ -101,7 +101,7 @@ public Map collectChunkPartStartNonces()
chunkPartStartNonces.putAll(plotFile.getChunkPartStartNonces());
if(expectedSize != chunkPartStartNonces.size())
{
- LOG.error("possible overlapping plot-file '" + plotFile.getFilePath() + "' please use 'https://bchain.info/BURST/tools/overlap' to check your plots.");
+ LOG.warn("possible overlapping plot-file '" + plotFile.getFilePath() + "', please check your plots.");
}
}
return chunkPartStartNonces;
diff --git a/src/main/java/burstcoin/jminer/core/reader/data/PlotFile.java b/src/main/java/burstcoin/jminer/core/reader/data/PlotFile.java
index a8b379e..7d75b2e 100644
--- a/src/main/java/burstcoin/jminer/core/reader/data/PlotFile.java
+++ b/src/main/java/burstcoin/jminer/core/reader/data/PlotFile.java
@@ -97,7 +97,7 @@ public PlotFile(Path filePath, Long chunkPartNonces)
Long key = chunkPartStartNonces.put(chunkPartStartNonce, chunkPartSize);
if(key != null)
{
- LOG.error("possible overlapping plot-file '" + filePath + "' please use 'https://bchain.info/BURST/tools/overlap' to check your plots.");
+ LOG.warn("possible overlapping plot-file '" + filePath + "', please check your plots.");
}
}
}
@@ -217,16 +217,32 @@ public Map getChunkPartStartNonces()
// to have steps of nearly same size
private int calculateNumberOfParts(long staggeramt)
{
+ int maxNumberOfParts = 100;
+
long targetNoncesPerPart = chunkPartNonces != null ? chunkPartNonces : 320000; // 640000 works fine
// calculate numberOfParts based on target
int suggestedNumberOfParts = (int) (staggeramt / targetNoncesPerPart) + 1;
// ensure stagger is dividable by numberOfParts, if not adjust numberOfParts
- while(staggeramt % suggestedNumberOfParts != 0)
+ while(staggeramt % suggestedNumberOfParts != 0 && suggestedNumberOfParts < maxNumberOfParts)
{
suggestedNumberOfParts += 1;
}
+
+ // fallback if number of parts could not be calculated in acceptable range
+ if(suggestedNumberOfParts >= maxNumberOfParts)
+ {
+ // as stagger has to be a multiple of 8 we can at least use 8 parts
+ if(staggeramt % 8 == 0)
+ {
+ suggestedNumberOfParts = 8;
+ }
+ else
+ {
+ LOG.warn("staggersize '" + staggeramt + "' is not dividable by 8.");
+ }
+ }
return suggestedNumberOfParts;
}
}
diff --git a/src/main/java/burstcoin/jminer/core/round/Round.java b/src/main/java/burstcoin/jminer/core/round/Round.java
index 7b8a195..00c491c 100644
--- a/src/main/java/burstcoin/jminer/core/round/Round.java
+++ b/src/main/java/burstcoin/jminer/core/round/Round.java
@@ -24,7 +24,6 @@
import burstcoin.jminer.core.CoreProperties;
import burstcoin.jminer.core.checker.Checker;
-import burstcoin.jminer.core.checker.event.CheckerDevResultEvent;
import burstcoin.jminer.core.checker.event.CheckerResultEvent;
import burstcoin.jminer.core.network.Network;
import burstcoin.jminer.core.network.event.NetworkDevResultConfirmedEvent;
@@ -159,7 +158,7 @@ public void handleMessage(NetworkStateChangeEvent event)
initNewRound(plots);
// reconfigure checker
- checker.reconfigure(blockNumber, baseTarget, targetDeadline, event.getGenerationSignature());
+ checker.reconfigure(blockNumber, event.getGenerationSignature());
// start reader
int scoopNumber = calcScoopNumber(event.getBlockNumber(), event.getGenerationSignature());
@@ -193,7 +192,7 @@ public void handleMessage(CheckerResultEvent event)
if(devPool)
{
- if(calculatedDeadline < targetDeadline)
+ if(calculatedDeadline <= targetDeadline)
{
// remember for next triggered commit
devPoolResults.add(new DevPoolResult(event.getBlockNumber(), calculatedDeadline, event.getNonce(), event.getChunkPartStartNonce()));
@@ -261,33 +260,6 @@ else if(calculatedDeadline < targetDeadline
}
}
- /**
- * Handle message.
- *
- * @param event the event
- */
- @EventListener
- public void handleMessage(CheckerDevResultEvent event)
- {
- if(blockNumber == event.getBlockNumber())
- {
- if(event.hasResults())
- {
- // remember for next triggered commit
- devPoolResults.addAll(event.getDevPoolResults());
- }
- else
- {
- runningChunkPartStartNonces.remove(event.getChunkPartStartNonce());
- triggerFinishRoundEvent(event.getBlockNumber());
- }
- }
- else
- {
- LOG.trace("event for previous block ...");
- }
- }
-
/**
* triggers commit devPool nonces if needed, there will be 'numberOfDevPoolCommitsPerRound'
*
@@ -306,6 +278,7 @@ else if(event.getRemainingCapacity() < (event.getCapacity() / devPoolCommitsPerR
{
devPoolCommitsThisRound--;
LOG.debug("trigger dev commit by progress #" + (devPoolCommitsPerRound - devPoolCommitsThisRound) + " this round.");
+
if(!devPoolResults.isEmpty())
{
commitDevPoolNonces(event.getBlockNumber());