From 0fd04f14a45d9261a1d4f3d1d2cb2ab605840ab3 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Sat, 11 Apr 2026 22:52:43 +0300 Subject: [PATCH] wallet: save last scanned block info to save progress on scan interruption --- Cargo.toml | 2 +- src/gui/views/wallets/wallet/txs/content.rs | 2 +- src/wallet/wallet.rs | 11 +++++++---- wallet | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 108af35..c43472c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ description = "Cross-platform GUI for Grin with focus on usability and availabil license = "Apache-2.0" repository = "https://code.gri.mw/GUI/grim" keywords = [ "crypto", "grin", "mimblewimble" ] -edition = "2021" +edition = "2024" build = "build.rs" [[bin]] diff --git a/src/gui/views/wallets/wallet/txs/content.rs b/src/gui/views/wallets/wallet/txs/content.rs index 2d530e8..983136f 100644 --- a/src/gui/views/wallets/wallet/txs/content.rs +++ b/src/gui/views/wallets/wallet/txs/content.rs @@ -87,7 +87,7 @@ const DELETE_TX_CONFIRMATION_MODAL: &'static str = "delete_tx_conf_modal"; impl WalletTransactionsContent { /// Height of transaction list item. - pub const TX_ITEM_HEIGHT: f32 = 73.0; + pub const TX_ITEM_HEIGHT: f32 = 75.0; /// Create new content instance with opening tx info. pub fn new(tx: Option) -> Self { diff --git a/src/wallet/wallet.rs b/src/wallet/wallet.rs index 9f49a2a..fa040e3 100644 --- a/src/wallet/wallet.rs +++ b/src/wallet/wallet.rs @@ -64,7 +64,7 @@ pub struct Wallet { instance: Arc>>, /// Connection of current wallet instance. connection: Arc>, - /// Wallet secret key for transport service. + /// Keychain mask for API calls. keychain_mask: Arc>>, /// Wallet Slatepack address to receive txs at transport. @@ -533,13 +533,16 @@ impl Wallet { if !self.is_open() || !has_instance { return; } - self.closing.store(true, Ordering::Relaxed); - + // Stop repairing. + if self.is_repairing() { + self.repair_needed.store(false, Ordering::Relaxed); + } // Close wallet at separate thread. let wallet_close = self.clone(); let service_id = wallet_close.identifier(); let conn = wallet_close.connection.clone(); thread::spawn(move || { + wallet_close.closing.store(true, Ordering::Relaxed); // Wait common operations to finish. while wallet_close.message_opening() || wallet_close.send_creating() || wallet_close.invoice_creating() { @@ -2191,10 +2194,10 @@ fn repair_wallet(wallet: &Wallet) { } }); - // Start wallet scanning. let r_inst = wallet.instance.as_ref().read(); let instance = r_inst.clone().unwrap(); let api = Owner::new(instance, Some(info_tx)); + // Start wallet scanning. match api.scan(wallet.keychain_mask().as_ref(), Some(1), false) { Ok(()) => { // Set sync error if scanning was not complete and wallet is open. diff --git a/wallet b/wallet index f54a8e7..4f3d9aa 160000 --- a/wallet +++ b/wallet @@ -1 +1 @@ -Subproject commit f54a8e77569dded4a48a5a55ebaf045dc0ff69c2 +Subproject commit 4f3d9aac25827f9d68a38c6e38af815845b4e1d9