From a67f7eedeb4eb808ffc4171fa40229e2e44374f2 Mon Sep 17 00:00:00 2001 From: Hansie Odendaal Date: Tue, 2 Apr 2024 14:45:35 +0200 Subject: [PATCH] Allow wallet type from db - Allow wallet type from the wallet database to have preference. This will allow old wallets without wallet type fields to be accepted as software wallets when added to the config file. - Set `newline_style = "Auto"` as we do not use JavaScript cucumber anymore; this was an issue on Windows. --- applications/minotari_ledger_wallet/rustfmt.toml | 2 +- base_layer/wallet/src/wallet.rs | 3 +-- rustfmt.toml | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/applications/minotari_ledger_wallet/rustfmt.toml b/applications/minotari_ledger_wallet/rustfmt.toml index 3bc22cf400..13868eb0c1 100644 --- a/applications/minotari_ledger_wallet/rustfmt.toml +++ b/applications/minotari_ledger_wallet/rustfmt.toml @@ -10,7 +10,7 @@ imports_layout = "HorizontalVertical" imports_granularity = "Crate" match_block_trailing_comma = true max_width = 120 -newline_style = "Native" +newline_style = "Auto" normalize_comments = true overflow_delimited_expr = true reorder_imports = true diff --git a/base_layer/wallet/src/wallet.rs b/base_layer/wallet/src/wallet.rs index 9728957771..33accdfb68 100644 --- a/base_layer/wallet/src/wallet.rs +++ b/base_layer/wallet/src/wallet.rs @@ -774,12 +774,11 @@ pub fn read_or_create_wallet_type( (None, None) => { panic!("Something is very wrong, no wallet type was found in the DB, or provided (on first run)") }, - (Some(_), Some(_)) => panic!("Something is very wrong we have a wallet type from the DB and on first run"), (None, Some(t)) => { db.set_wallet_type(t)?; Ok(t) }, - (Some(t), None) => Ok(t), + (Some(t), _) => Ok(t), } } diff --git a/rustfmt.toml b/rustfmt.toml index 3bc22cf400..13868eb0c1 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -10,7 +10,7 @@ imports_layout = "HorizontalVertical" imports_granularity = "Crate" match_block_trailing_comma = true max_width = 120 -newline_style = "Native" +newline_style = "Auto" normalize_comments = true overflow_delimited_expr = true reorder_imports = true