Skip to content

Commit f9c0203

Browse files
committed
create wallet before the spawn
1 parent 49fbc8d commit f9c0203

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

tests/message-board-sync.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ async fn test_message_board() {
2323
initialize();
2424
#[cfg(feature = "wasm-parallel")]
2525
let _ = wasm_bindgen_futures::JsFuture::from(wasm_bindgen_rayon::init_thread_pool(10)).await;
26+
let w = WebWallet::new("main", "http://localhost:1234/mainnet", 1).unwrap();
27+
let w_clone = w.clone();
2628
let main_handler = thread::Builder::new()
27-
.spawn_async(|| async {
28-
let w = WebWallet::new("main", "http://localhost:1234/mainnet", 1).unwrap();
29-
29+
.spawn_async(move || async {
30+
let w = w_clone;
3031
let s = zcash_keys::encoding::decode_extended_full_viewing_key(
3132
constants::mainnet::HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY,
3233
SAPLING_EFVK.trim(),

tests/simple-sync-and-send.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,15 @@ async fn test_get_and_scan_range() {
2626
#[cfg(feature = "wasm-parallel")]
2727
let _ = JsFuture::from(wasm_bindgen_rayon::init_thread_pool(10)).await;
2828
assert!(!thread::is_web_worker_thread());
29-
let main_handler = thread::Builder::new().spawn_async(|| async {
29+
let w = WebWallet::new("test", "http://localhost:1234/testnet", 1).unwrap();
30+
31+
let id = w.create_account(SEED, HD_INDEX, BIRTHDAY).await.unwrap();
32+
tracing::info!("Created account with id: {}", id);
33+
let w_clone = w.clone();
34+
let main_handler = thread::Builder::new().spawn_async(move || async {
35+
let w = w_clone;
3036
assert!(thread::is_web_worker_thread());
31-
let w = WebWallet::new("test", "http://localhost:1234/testnet", 1).unwrap();
3237

33-
let id = w.create_account(SEED, HD_INDEX, BIRTHDAY).await.unwrap();
34-
tracing::info!("Created account with id: {}", id);
3538

3639
#[cfg(not(feature = "sync2"))]
3740
{

0 commit comments

Comments
 (0)