Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
17 changes: 9 additions & 8 deletions src/backend_task/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
3 changes: 1 addition & 2 deletions src/database/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down
13 changes: 9 additions & 4 deletions src/model/qualified_identity/qualified_identity_public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
8 changes: 8 additions & 0 deletions src/ui/network_chooser_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading