ensure old compilation is removed when building new program
enable threads for pow log and test tweaks
This commit is contained in:
@ -66,11 +66,14 @@ public class POW {
|
||||
Heap heap = new Heap();
|
||||
char[][] solutions = new char[8][8];
|
||||
|
||||
if (effort > 2)
|
||||
if (effort > 2) {
|
||||
ctx.request_compile = true;
|
||||
ctx.threads = 4;
|
||||
}
|
||||
|
||||
int runs = 0;
|
||||
while (runs++ < maxruns) {
|
||||
System.out.println("Starting run " + runs);
|
||||
int count = Equix.solve(ctx, heap, challenge, CHALLENGE_LEN, solutions, 0);
|
||||
if (count == 0) {
|
||||
System.out.println("No solutions found on run " + runs);
|
||||
@ -176,10 +179,12 @@ public class POW {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
int effort = 8;
|
||||
if (args.length > 0)
|
||||
effort = Integer.parseInt(args[0]);
|
||||
HXCtx ctx = new HXCtx(512);
|
||||
Hash h = Hash.FAKE_HASH;
|
||||
byte[] seed = h.getData();
|
||||
int effort = 8;
|
||||
byte[] proof = solve(ctx, h, seed, effort, 999);
|
||||
if (proof != null) {
|
||||
System.out.println("Found solution:\n" + HexDump.dump(proof));
|
||||
|
@ -69,6 +69,7 @@ public class Equix {
|
||||
*/
|
||||
public static int solve(HXCtx ctx, Heap heap, byte[] challenge, int csz, char[][] solutions, int solution_count) {
|
||||
if (ctx.code_size == 0 || !DataHelper.eq(challenge, 0, ctx.seed, 0, csz)) {
|
||||
System.out.println("Generating new HashX for solving");
|
||||
if (!HashX.make(ctx, challenge, csz)) {
|
||||
System.out.println("FAILED to generate HashX for solving");
|
||||
return 0;
|
||||
|
@ -319,7 +319,7 @@ class Solver {
|
||||
long start = System.currentTimeMillis();
|
||||
stage0(ctx, heap);
|
||||
long now = System.currentTimeMillis();
|
||||
System.out.println("stage0() took " + (now - start));
|
||||
System.out.println("stage0() took " + (now - start) + " (threads: " + ctx.threads + ")");
|
||||
start = now;
|
||||
|
||||
stage1(heap);
|
||||
|
@ -33,7 +33,7 @@ class Threads {
|
||||
*/
|
||||
private static class CustomThreadPoolExecutor extends ThreadPoolExecutor {
|
||||
public CustomThreadPoolExecutor() {
|
||||
super(0, Integer.MAX_VALUE, HANDLER_KEEPALIVE_MS, TimeUnit.MILLISECONDS,
|
||||
super(4, Integer.MAX_VALUE, HANDLER_KEEPALIVE_MS, TimeUnit.MILLISECONDS,
|
||||
new SynchronousQueue<Runnable>(), new CustomThreadFactory());
|
||||
}
|
||||
}
|
||||
@ -46,6 +46,7 @@ class Threads {
|
||||
Thread rv = Executors.defaultThreadFactory().newThread(r);
|
||||
rv.setName("jequix hasher " + _executorThreadCount.incrementAndGet());
|
||||
rv.setDaemon(true);
|
||||
System.out.println("Starting thread " + rv.getName());
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ public class HashX {
|
||||
*/
|
||||
public static boolean make(HXCtx ctx, byte[] seed, int size) {
|
||||
long start = System.currentTimeMillis();
|
||||
ctx.compiled = false;
|
||||
ctx.compiled_method = null;
|
||||
ctx.seed = Arrays.copyOf(seed, size);
|
||||
MessageDigest blake = new Blake2bMessageDigest(HASHX_PERSONAL, HASHX_SALT);
|
||||
blake.update(seed, 0, size);
|
||||
|
Reference in New Issue
Block a user