nano-pow 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/cli.js CHANGED
@@ -38,9 +38,9 @@ If using --validate, results will also include validity properties.
38
38
 
39
39
  -h, --help show this dialog
40
40
  --debug enable additional logging output
41
- --benchmark <value> generate work for specified number of random hashes
41
+ --benchmark <value> generate work for specified number of random hashes
42
42
 
43
- -b, --batch process all data before returning final results as array
43
+ -b, --batch process all data before returning final results as array
44
44
  -d, --difficulty <value> override the minimum difficulty value
45
45
  -e, --effort <value> increase demand on GPU processing
46
46
  -v, --validate <value> check an existing work value instead of searching for one
@@ -129,7 +129,7 @@ const start = performance.now();
129
129
  for (const hash of hashes) {
130
130
  try {
131
131
  body.hash = hash;
132
- const kill = setTimeout(aborter.abort, 5e3);
132
+ const kill = setTimeout(() => aborter.abort(), 6e4);
133
133
  const response = await fetch(`http://localhost:${process.env.NANO_POW_PORT}`, {
134
134
  method: "POST",
135
135
  body: JSON.stringify(body),
@@ -11,6 +11,10 @@ mkdir -p "$NANO_POW_LOGS";
11
11
  if [ "$1" = '--server' ]; then
12
12
  shift;
13
13
  node "$SCRIPT_DIR"/server.js > "$NANO_POW_LOGS"/nano-pow-server-$(date -u -Iseconds).log 2>&1 & echo "$!" > "$NANO_POW_HOME"/server.pid;
14
+ sleep 0.1;
15
+ if [ "$(ps | grep $(cat $NANO_POW_HOME/server.pid))" = '' ]; then
16
+ cat $(ls -td "$NANO_POW_LOGS"/* | head -n1);
17
+ fi;
14
18
  else
15
19
  node "$SCRIPT_DIR"/cli.js "$@";
16
20
  fi;
package/dist/main.min.js CHANGED
@@ -227,6 +227,7 @@ var NanoPowGl = class _NanoPowGl {
227
227
  _NanoPowGl.#drawProgram = null;
228
228
  _NanoPowGl.#gl = null;
229
229
  _NanoPowGl.#busy = false;
230
+ _NanoPowGl.#isInitialized = false;
230
231
  _NanoPowGl.init();
231
232
  }
232
233
  static #logAverages(times) {
@@ -353,7 +354,7 @@ var NanoPowGl = class _NanoPowGl {
353
354
  setTimeout(async () => {
354
355
  const result2 = this.work_generate(hash, options);
355
356
  resolve(result2);
356
- }, 100);
357
+ }, 500);
357
358
  });
358
359
  }
359
360
  if (this.#isInitialized === false) this.init();
@@ -438,7 +439,7 @@ var NanoPowGl = class _NanoPowGl {
438
439
  setTimeout(async () => {
439
440
  const result2 = this.work_validate(work, hash, options);
440
441
  resolve(result2);
441
- }, 100);
442
+ }, 500);
442
443
  });
443
444
  }
444
445
  if (this.#isInitialized === false) this.init();
@@ -604,6 +605,7 @@ var NanoPowGpu = class _NanoPowGpu {
604
605
  _NanoPowGpu.#gpuBuffer?.destroy();
605
606
  _NanoPowGpu.#uboBuffer?.destroy();
606
607
  _NanoPowGpu.#busy = false;
608
+ _NanoPowGpu.#isInitialized = false;
607
609
  _NanoPowGpu.init();
608
610
  }
609
611
  static #logAverages(times) {
@@ -683,7 +685,8 @@ var NanoPowGpu = class _NanoPowGpu {
683
685
  this.#cpuBuffer.unmap();
684
686
  } catch (err) {
685
687
  console.warn(`Error getting data from GPU. ${err}`);
686
- return this.#dispatch(pipeline, seed, hash, difficulty, passes);
688
+ this.#cpuBuffer.unmap();
689
+ this.reset();
687
690
  }
688
691
  if (this.#debug) console.log("gpuBuffer data", data);
689
692
  if (data == null) throw new Error(`Failed to get data from buffer.`);
@@ -703,7 +706,7 @@ var NanoPowGpu = class _NanoPowGpu {
703
706
  setTimeout(async () => {
704
707
  const result2 = this.work_generate(hash, options);
705
708
  resolve(result2);
706
- }, 100);
709
+ }, 500);
707
710
  });
708
711
  }
709
712
  if (this.#isInitialized === false) this.init();
@@ -773,7 +776,7 @@ var NanoPowGpu = class _NanoPowGpu {
773
776
  setTimeout(async () => {
774
777
  const result2 = this.work_validate(work, hash, options);
775
778
  resolve(result2);
776
- }, 100);
779
+ }, 500);
777
780
  });
778
781
  }
779
782
  if (this.#isInitialized === false) this.init();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nano-pow",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "Proof-of-work generation and validation with WebGPU/WebGL for Nano cryptocurrency.",
5
5
  "keywords": [
6
6
  "nemo",