mirror of
https://code.gri.mw/GUI/grim.git
synced 2026-07-04 05:57:29 +00:00
wallet: save last scanned block info to save progress on scan interruption
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@ description = "Cross-platform GUI for Grin with focus on usability and availabil
|
|||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
repository = "https://code.gri.mw/GUI/grim"
|
repository = "https://code.gri.mw/GUI/grim"
|
||||||
keywords = [ "crypto", "grin", "mimblewimble" ]
|
keywords = [ "crypto", "grin", "mimblewimble" ]
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ const DELETE_TX_CONFIRMATION_MODAL: &'static str = "delete_tx_conf_modal";
|
|||||||
|
|
||||||
impl WalletTransactionsContent {
|
impl WalletTransactionsContent {
|
||||||
/// Height of transaction list item.
|
/// 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.
|
/// Create new content instance with opening tx info.
|
||||||
pub fn new(tx: Option<WalletTx>) -> Self {
|
pub fn new(tx: Option<WalletTx>) -> Self {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ pub struct Wallet {
|
|||||||
instance: Arc<RwLock<Option<WalletInstance>>>,
|
instance: Arc<RwLock<Option<WalletInstance>>>,
|
||||||
/// Connection of current wallet instance.
|
/// Connection of current wallet instance.
|
||||||
connection: Arc<RwLock<ConnectionMethod>>,
|
connection: Arc<RwLock<ConnectionMethod>>,
|
||||||
/// Wallet secret key for transport service.
|
/// Keychain mask for API calls.
|
||||||
keychain_mask: Arc<RwLock<Option<SecretKey>>>,
|
keychain_mask: Arc<RwLock<Option<SecretKey>>>,
|
||||||
|
|
||||||
/// Wallet Slatepack address to receive txs at transport.
|
/// Wallet Slatepack address to receive txs at transport.
|
||||||
@@ -533,13 +533,16 @@ impl Wallet {
|
|||||||
if !self.is_open() || !has_instance {
|
if !self.is_open() || !has_instance {
|
||||||
return;
|
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.
|
// Close wallet at separate thread.
|
||||||
let wallet_close = self.clone();
|
let wallet_close = self.clone();
|
||||||
let service_id = wallet_close.identifier();
|
let service_id = wallet_close.identifier();
|
||||||
let conn = wallet_close.connection.clone();
|
let conn = wallet_close.connection.clone();
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
|
wallet_close.closing.store(true, Ordering::Relaxed);
|
||||||
// Wait common operations to finish.
|
// Wait common operations to finish.
|
||||||
while wallet_close.message_opening() || wallet_close.send_creating() ||
|
while wallet_close.message_opening() || wallet_close.send_creating() ||
|
||||||
wallet_close.invoice_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 r_inst = wallet.instance.as_ref().read();
|
||||||
let instance = r_inst.clone().unwrap();
|
let instance = r_inst.clone().unwrap();
|
||||||
let api = Owner::new(instance, Some(info_tx));
|
let api = Owner::new(instance, Some(info_tx));
|
||||||
|
// Start wallet scanning.
|
||||||
match api.scan(wallet.keychain_mask().as_ref(), Some(1), false) {
|
match api.scan(wallet.keychain_mask().as_ref(), Some(1), false) {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
// Set sync error if scanning was not complete and wallet is open.
|
// Set sync error if scanning was not complete and wallet is open.
|
||||||
|
|||||||
+1
-1
Submodule wallet updated: f54a8e7756...4f3d9aac25
Reference in New Issue
Block a user