From e24de9a52b4510c5c2a0e92a83dd1c39f4eb612f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren?= Date: Thu, 25 Jul 2024 08:49:13 +0200 Subject: [PATCH] Don't abort client init when GenesisConfig is already initialized This way one can initialize the GenesisConfig for mainnet before starting the client, and then use the demo page to connect to the mainnet. --- index.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index b1d3bf3..4ad9c3b 100644 --- a/index.html +++ b/index.html @@ -60,8 +60,13 @@ nimiqInitPromise.then(async () => { document.getElementById('message').innerText = 'Nimiq loaded. Connecting and establishing consensus.'; - // Connect to the testnet. - Nimiq.GenesisConfig.test(); + try { + // Try to connect to the testnet. + Nimiq.GenesisConfig.test(); + } catch (error) { + console.error(error); + // Don't fail if GenesisConfig has already been initialized (e.g. for mainnet). + } const $ = {}; window.$ = $;