From a0df3d4428993db111e9319fe69fd2f56bc2b8fb Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sun, 28 Sep 2025 04:03:39 +0000 Subject: [PATCH] chore: cleanups Signed-off-by: Xe Iaso --- wasm/wasm.go | 5 +++++ web/js/algorithms/index.ts | 2 +- web/js/worker/wasm.ts | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wasm/wasm.go b/wasm/wasm.go index 742b7feb..9a5d9058 100644 --- a/wasm/wasm.go +++ b/wasm/wasm.go @@ -8,6 +8,7 @@ import ( "math" "os" "strconv" + "sync" "time" "github.com/prometheus/client_golang/prometheus" @@ -35,6 +36,7 @@ type Runner struct { r wazero.Runtime code wazero.CompiledModule fname string + lock sync.Mutex } func NewRunner(ctx context.Context, fname string, fin io.ReadCloser) (*Runner, error) { @@ -269,6 +271,9 @@ func (r *Runner) verify(ctx context.Context, data, verify []byte, nonce, difficu } func (r *Runner) Verify(ctx context.Context, data, verify []byte, nonce, difficulty uint32) (bool, error) { + r.lock.Lock() + defer r.lock.Unlock() + t0 := time.Now() ok, _, err := r.verify(ctx, data, verify, nonce, difficulty) validationTime.WithLabelValues(r.fname).Observe(float64(time.Since(t0))) diff --git a/web/js/algorithms/index.ts b/web/js/algorithms/index.ts index e31a024f..8972632d 100644 --- a/web/js/algorithms/index.ts +++ b/web/js/algorithms/index.ts @@ -5,6 +5,6 @@ export default { fast: fast, slow: fast, // XXX(Xe): slow is deprecated, but keep this around in case anything goes bad - argon2id: wasm, + hashx: wasm, sha256: wasm, } \ No newline at end of file diff --git a/web/js/worker/wasm.ts b/web/js/worker/wasm.ts index cddbe427..dfa59401 100644 --- a/web/js/worker/wasm.ts +++ b/web/js/worker/wasm.ts @@ -16,7 +16,6 @@ interface AnubisExports { } addEventListener("message", async (event: MessageEvent) => { - console.log(event.data); const { data, difficulty, threads, module } = event.data; let { nonce } = event.data;