Skip to content

Commit 4df3e74

Browse files
authored
[bugfix] Fix sync error when add validator (#444)
1 parent f5fee69 commit 4df3e74

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

aptos-core/consensus/src/block_storage/sync_manager.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ impl BlockStore {
507507
if self.commit_root().round() < ledger_info.commit_info().round()
508508
&& self.block_exists(ledger_info.commit_info().id())
509509
&& self.ordered_root().round() >= ledger_info.commit_info().round()
510-
&& (!self.enable_randomness || self.ordered_root().epoch() == 1 || self.ordered_root().randomness().is_some())
510+
&& (!self.enable_randomness || self.ordered_root().epoch() == 1 || ledger_info.commit_info().round() == 0 || self.ordered_root().randomness().is_some())
511511
{
512512
info!("sync_to_highest_commit_cert: block exists between commit root and ordered root {:?}, {:?}", self.commit_root().round(), ledger_info.commit_info().round());
513513
let proof = ledger_info.clone();
@@ -516,8 +516,7 @@ impl BlockStore {
516516
return Ok(());
517517
} else if self.ordered_root().round() < ledger_info.commit_info().round()
518518
&& !self.block_exists(ledger_info.commit_info().id())
519-
|| (self.enable_randomness && self.ordered_root().epoch() != 1 && self.ordered_root().randomness().is_none()) {
520-
519+
|| (self.enable_randomness && self.ordered_root().epoch() != 1 && ledger_info.commit_info().round() != 0 && self.ordered_root().randomness().is_none()) {
521520
// Get the appropriate WrappedLedgerInfo based on randomness check
522521
let sync_from_cert = self.has_randomness_on_path_from_ordered_to_commit();
523522

0 commit comments

Comments
 (0)