Skip to content

Commit

Permalink
chore: prevent from clearing wallet data after restart (tari-project#…
Browse files Browse the repository at this point in the history
…1366)

Description
We've been clearing the wallet database on startup which forced scanning
UTXOs from the tip 0 on every run. Scanning takes really long time each
run:
```
DEBUG Scanning round completed up to height 84661 in 440.07s (2116869 outputs scanned, 1478 recovered with value 1479069.697509 T)
```
Clearing was done when we had issues with view keys. Since it's gone, we
can keep wallet dir and support caching.

How Has This Been Tested?
---
I tested manually by running the app several times and watching wallet
logs(base_layer.log) to check whether wallet uses previously scanned
blocks.
```
Scanning round completed up to height 85291 in 301.62ms (70 outputs scanned, 0 recovered with value 0 µT)
```

I also played with displaying seed words and importing new wallets to
ensure everything is doesn't break anything related to the view keys

---------

Co-authored-by: Brian Pearce <[email protected]>
Co-authored-by: brianp <[email protected]>
  • Loading branch information
3 people authored Jan 14, 2025
1 parent dddc853 commit 0aceb44
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src-tauri/src/wallet_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ impl ProcessAdapter for WalletAdapter {
.join(Network::get_current_or_user_setting_or_default().to_string())
.join("peer_db");

let wallet_data_folder =
working_dir.join(Network::get_current_or_user_setting_or_default().to_string());

if self.use_tor {
args.push("-p".to_string());
args.push("wallet.p2p.transport.tor.proxy_bypass_for_outbound_tcp=true".to_string())
Expand Down Expand Up @@ -173,11 +170,6 @@ impl ProcessAdapter for WalletAdapter {
warn!(target: LOG_TARGET, "Could not clear peer data folder: {}", e);
}

// Delete any old wallets on startup
if let Err(e) = std::fs::remove_dir_all(&wallet_data_folder) {
warn!(target: LOG_TARGET, "Could not clear wallet data folder: {}", e);
}

#[cfg(target_os = "windows")]
add_firewall_rule(
"minotari_console_wallet.exe".to_string(),
Expand Down

0 comments on commit 0aceb44

Please sign in to comment.