diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cf01bed..d629ae7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## Version 0.56.1 + +- Fix unstable sync (key blocks mismatch) + ## Version 0.56.0 - Get rid of ton::bytes type diff --git a/Cargo.toml b/Cargo.toml index a8d03d84..d0127e4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ build = 'common/build/build.rs' edition = '2021' name = 'ton_node' -version = '0.56.0' +version = '0.56.1' [workspace] members = [ 'storage' ] diff --git a/src/boot.rs b/src/boot.rs index 3c8c9918..bd15377b 100644 --- a/src/boot.rs +++ b/src/boot.rs @@ -151,9 +151,11 @@ async fn get_key_blocks( zero_state: Option<&Arc>, mut prev_block_proof: Option ) -> Result>> { + const MAX_RETRIES: usize = 100; let mut hardfork_iter = engine.hardforks().iter(); let mut hardfork = hardfork_iter.next(); let mut key_blocks = vec!(handle.clone()); + let mut stuck_count = 0; 'main_loop: loop { if engine.check_stop() { fail!("Boot was stopped"); @@ -167,10 +169,24 @@ async fn get_key_blocks( } Ok(ids) => { if let Some(block_id) = ids.last() { + stuck_count = 0; log::info!(target: "boot", "last key block is {}", block_id); ids } else { - return Ok(key_blocks); + stuck_count += 1; + if let Some(handle) = key_blocks.last() { + let utime = handle.gen_utime()?; + log::info!( + target: "boot", + "Stuck {} times on last key block time diff: {}", + stuck_count, engine.now() - utime + ); + } + if stuck_count >= MAX_RETRIES { + return Ok(key_blocks) + } else { + continue 'main_loop + } } } };