feat(solver-wasm): replace outdated wee-alloc with FreeListAllocator from lol-alloc

This commit is contained in:
2025-07-14 20:39:38 +02:00
parent df4daa1b77
commit d5ceaad797
3 changed files with 47 additions and 52 deletions

View File

@@ -1,11 +1,12 @@
extern crate wee_alloc;
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
use sha2::{Digest, Sha256};
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
#[global_allocator]
static ALLOCATOR: lol_alloc::AssumeSingleThreaded<lol_alloc::FreeListAllocator> =
// SAFETY: This application is single threaded, so using AssumeSingleThreaded is allowed.
unsafe { lol_alloc::AssumeSingleThreaded::new(lol_alloc::FreeListAllocator::new()) };
#[wasm_bindgen]
pub fn solve(nonce: Box<[u8]>, target: Box<[u8]>, difficulty_bits: u32) -> Box<[u8]> {
let mut buf = vec![0u8; 8 + nonce.len()];