Skip to content

Commit

Permalink
Merge pull request #106 from AvailX/fix/scan-after-recovery
Browse files Browse the repository at this point in the history
Fixes Scanning issue after recovery
  • Loading branch information
dev-blc authored Jun 21, 2024
2 parents 84413f9 + a1896ff commit 1d3d142
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleShortVersionString</key>
<string>0.3.0</string>
<string>0.4.1</string>
<key>CFBundleVersion</key>
<string>20240222.152850</string>
<key>CSResourcesFileMapped</key>
Expand Down
22 changes: 22 additions & 0 deletions src-tauri/src/services/record_handling/records.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,4 +853,26 @@ mod record_handling_test {
handle_unconfirmed_transactions::<TestnetV0>().await.unwrap();
}
*/

#[tokio::test]
async fn test_good_block_height() {
let api_client = setup_client::<TestnetV0>().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;
}
};
}
}
}
7 changes: 6 additions & 1 deletion src-tauri/src/services/record_handling/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ pub async fn txs_sync_raw<N: Network>() -> AvailResult<TxScanResponse> {
#[tauri::command(rename_all = "snake_case")]
pub async fn blocks_sync(height: u32, window: Window) -> AvailResult<bool> {
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);

Expand Down

0 comments on commit 1d3d142

Please sign in to comment.