diff --git a/src/app.rs b/src/app.rs index 4bdd7929a..f8cfc6e8b 100644 --- a/src/app.rs +++ b/src/app.rs @@ -194,11 +194,19 @@ impl AppState { TokensScreen::new(&mainnet_app_context, TokensSubscreen::TokenCreator); let (custom_dash_qt_path, overwrite_dash_conf) = match settings.clone() { - Some((.., Some(db_custom_dash_qt_path), db_overwrite_dash_qt)) => { - (Some(db_custom_dash_qt_path), db_overwrite_dash_qt) + Some((.., custom_dash_qt_path, db_overwrite_dash_conf)) => { + // Use the stored settings, even if custom_dash_qt_path is None + let dash_qt_path = custom_dash_qt_path.or_else(|| { + // If no custom path is set, try to find dash-qt in PATH + which::which("dash-qt") + .map(|path| path.to_string_lossy().to_string()) + .inspect_err(|e| tracing::warn!("failed to find dash-qt: {}", e)) + .ok() + }); + (dash_qt_path, db_overwrite_dash_conf) } - _ => { - // Find `dash-qt` executable in the system PATH as default, and overwrite dash.conf + None => { + // Only use defaults if there are no settings at all let dash_qt = which::which("dash-qt") .map(|path| path.to_string_lossy().to_string()) .inspect_err(|e| tracing::warn!("failed to find dash-qt: {}", e)) diff --git a/src/backend_task/contract.rs b/src/backend_task/contract.rs index 982993c33..cbc40eb5e 100644 --- a/src/backend_task/contract.rs +++ b/src/backend_task/contract.rs @@ -124,14 +124,15 @@ impl AppContext { token_infos.push(token_info); } - let contract_description_info = document_option.map(|document| ContractDescriptionInfo { - data_contract_id: contract.id(), - description: document - .get("description") - .and_then(|v| v.as_text()) - .unwrap_or_default() - .to_string(), - }); + let contract_description_info = + document_option.map(|document| ContractDescriptionInfo { + data_contract_id: contract.id(), + description: document + .get("description") + .and_then(|v| v.as_text()) + .unwrap_or_default() + .to_string(), + }); results.insert( contract.id(), diff --git a/src/database/settings.rs b/src/database/settings.rs index b4e301cc9..a388d006a 100644 --- a/src/database/settings.rs +++ b/src/database/settings.rs @@ -19,8 +19,7 @@ impl Database { VALUES (1, ?, ?, 1) ON CONFLICT(id) DO UPDATE SET network = excluded.network, - start_root_screen = excluded.start_root_screen, - database_version = excluded.database_version", + start_root_screen = excluded.start_root_screen", params![network_str, screen_type_int], )?; Ok(()) diff --git a/src/model/qualified_identity/qualified_identity_public_key.rs b/src/model/qualified_identity/qualified_identity_public_key.rs index 6c6ff5276..c6d6193d3 100644 --- a/src/model/qualified_identity/qualified_identity_public_key.rs +++ b/src/model/qualified_identity/qualified_identity_public_key.rs @@ -50,8 +50,9 @@ impl QualifiedIdentityPublicKey { if value.data().len() == 20 { // This is actually a hash, treat it as ECDSA_HASH160 let hash160_data = value.data().as_slice(); - let pubkey_hash = PubkeyHash::from_slice(hash160_data) - .expect("Expected valid 20-byte pubkey hash for ECDSA_SECP256K1 with hash data"); + let pubkey_hash = PubkeyHash::from_slice(hash160_data).expect( + "Expected valid 20-byte pubkey hash for ECDSA_SECP256K1 with hash data", + ); let address = Address::new(network, Payload::PubkeyHash(pubkey_hash)); @@ -78,7 +79,9 @@ impl QualifiedIdentityPublicKey { } if let Some(testnet_address) = testnet_address.as_ref() { - if let Some(derivation_path) = wallet.known_addresses.get(testnet_address) { + if let Some(derivation_path) = + wallet.known_addresses.get(testnet_address) + { in_wallet_at_derivation_path = Some(WalletDerivationPath { wallet_seed_hash: wallet.seed_hash(), derivation_path: derivation_path.clone(), @@ -117,7 +120,9 @@ impl QualifiedIdentityPublicKey { } if let Some(testnet_address) = testnet_address.as_ref() { - if let Some(derivation_path) = wallet.known_addresses.get(testnet_address) { + if let Some(derivation_path) = + wallet.known_addresses.get(testnet_address) + { in_wallet_at_derivation_path = Some(WalletDerivationPath { wallet_seed_hash: wallet.seed_hash(), derivation_path: derivation_path.clone(), diff --git a/src/ui/network_chooser_screen.rs b/src/ui/network_chooser_screen.rs index e3470933f..b9255fb3c 100644 --- a/src/ui/network_chooser_screen.rs +++ b/src/ui/network_chooser_screen.rs @@ -589,6 +589,14 @@ impl ScreenLike for NetworkChooserScreen { // Reset collapsing states when arriving at this screen // This ensures dropdowns are closed when navigating back self.should_reset_collapsing_states = true; + + // Reload settings from database to ensure we have the latest values + if let Ok(Some((_, _, _, custom_dash_qt_path, overwrite_dash_conf))) = + self.current_app_context().get_settings() + { + self.custom_dash_qt_path = custom_dash_qt_path; + self.overwrite_dash_conf = overwrite_dash_conf; + } } fn display_message(&mut self, message: &str, _message_type: super::MessageType) {