From 412614a0c818af9b105eaa81421eee6825dc2cf3 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Fri, 10 Nov 2023 17:25:58 -0600 Subject: [PATCH] don't initialize wasm twice --- src/logic/mutinyWalletSetup.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/logic/mutinyWalletSetup.ts b/src/logic/mutinyWalletSetup.ts index 176c043..9e7d010 100644 --- a/src/logic/mutinyWalletSetup.ts +++ b/src/logic/mutinyWalletSetup.ts @@ -187,7 +187,16 @@ export async function doubleInitDefense() { export async function initializeWasm() { // Actually intialize the WASM, this should be the first thing that requires the WASM blob to be downloaded - await initMutinyWallet(); + + // If WASM is already initialized, don't init twice + try { + const _sats_the_standard = MutinyWallet.convert_btc_to_sats(1); + console.debug("MutinyWallet WASM already initialized, skipping init"); + return; + } catch (e) { + console.debug("MutinyWallet WASM about to be initialized"); + await initMutinyWallet(); + } } export async function setupMutinyWallet(