Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unstable sync #224

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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' ]
Expand Down
18 changes: 17 additions & 1 deletion src/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ async fn get_key_blocks(
zero_state: Option<&Arc<ShardStateStuff>>,
mut prev_block_proof: Option<BlockProofStuff>
) -> Result<Vec<Arc<BlockHandle>>> {
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");
Expand All @@ -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
}
}
}
};
Expand Down