Skip to content
Merged
Changes from 1 commit
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
25 changes: 15 additions & 10 deletions crates/sui-core/src/authority/authority_per_epoch_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2951,15 +2951,6 @@ impl AuthorityPerEpochStore {
}
}
checkpoint_roots.extend(roots.into_iter());
let pending_checkpoint = PendingCheckpointV2::V2(PendingCheckpointV2Contents {
roots: checkpoint_roots,
details: PendingCheckpointInfo {
timestamp_ms: consensus_commit_info.timestamp,
last_of_epoch: final_round && randomness_round.is_none(),
checkpoint_height,
},
});
self.write_pending_checkpoint(&mut output, &pending_checkpoint)?;

// Generate pending checkpoint for user tx with randomness.
// - If randomness is not generated for this commit, we will skip the
Expand All @@ -2973,7 +2964,21 @@ impl AuthorityPerEpochStore {
randomness_round,
));
}
if randomness_round.is_some() || (dkg_failed && !randomness_roots.is_empty()) {

let should_write_random_checkpoint =
randomness_round.is_some() || (dkg_failed && !randomness_roots.is_empty());

let pending_checkpoint = PendingCheckpointV2::V2(PendingCheckpointV2Contents {
roots: checkpoint_roots,
details: PendingCheckpointInfo {
timestamp_ms: consensus_commit_info.timestamp,
last_of_epoch: final_round && !should_write_random_checkpoint,
checkpoint_height,
},
});
self.write_pending_checkpoint(&mut output, &pending_checkpoint)?;

if should_write_random_checkpoint {
let pending_checkpoint = PendingCheckpointV2::V2(PendingCheckpointV2Contents {
roots: randomness_roots.into_iter().collect(),
details: PendingCheckpointInfo {
Expand Down
Loading