diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 3abbd84..41ea80f 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -451,7 +451,7 @@ dependencies = [ [[package]] name = "avail_wallet" -version = "0.4.0" +version = "0.4.1" dependencies = [ "app_dirs2", "avail-common", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index dddf71b..379e27c 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "avail_wallet" -version = "0.4.0" +version = "0.4.1" description = "Avail Wallet | Make it yours." authors = ["Avail"] license = "Apache-2.0" diff --git a/src-tauri/Info.plist b/src-tauri/Info.plist index 5452a2e..c277d93 100644 --- a/src-tauri/Info.plist +++ b/src-tauri/Info.plist @@ -32,7 +32,7 @@ CFBundleShortVersionString - 0.3.0 + 0.4.1 CFBundleVersion 20240222.152850 CSResourcesFileMapped diff --git a/src-tauri/src/services/record_handling/records.rs b/src-tauri/src/services/record_handling/records.rs index f51ff1b..00c4e24 100644 --- a/src-tauri/src/services/record_handling/records.rs +++ b/src-tauri/src/services/record_handling/records.rs @@ -853,4 +853,26 @@ mod record_handling_test { handle_unconfirmed_transactions::().await.unwrap(); } */ + + #[tokio::test] + async fn test_good_block_height() { + let api_client = setup_client::().unwrap(); + let latest_height = api_client.latest_height().unwrap(); + let mut last_sync = 0u32; + let mut flag = true; + while flag { + let last_sync_block = match api_client.get_block(last_sync) { + Ok(block) => { + println!("Block: {:?}", block); + flag = false; + block + } + Err(e) => { + println!("Error getting block: {:?}", e.to_string()); + last_sync += 1; + continue; + } + }; + } + } } diff --git a/src-tauri/src/services/record_handling/sync.rs b/src-tauri/src/services/record_handling/sync.rs index 343cfa2..96458b7 100644 --- a/src-tauri/src/services/record_handling/sync.rs +++ b/src-tauri/src/services/record_handling/sync.rs @@ -164,7 +164,12 @@ pub async fn txs_sync_raw() -> AvailResult { #[tauri::command(rename_all = "snake_case")] pub async fn blocks_sync(height: u32, window: Window) -> AvailResult { let network = get_network()?; - let last_sync = get_last_sync()?; + // TEMPORARY - Solution to handle full resync + let last_sync = if get_last_sync()? == 0 { + 1u32 + } else { + get_last_sync()? as u32 + }; print!("From Last Sync: {:?} to height: {:?}", last_sync, height);