Skip to content

Commit

Permalink
[authority] Remove unused cached checkpoint number (#4690)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind authored Sep 19, 2022
1 parent b41bbf4 commit a677c26
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions crates/sui-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use std::{
collections::{HashMap, VecDeque},
pin::Pin,
sync::{
atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering},
atomic::{AtomicBool, AtomicUsize, Ordering},
Arc,
},
};
Expand Down Expand Up @@ -410,9 +410,6 @@ pub struct AuthorityState {

pub metrics: Arc<AuthorityMetrics>,

// Cache the latest checkpoint number to avoid expensive locking to access checkpoint store
latest_checkpoint_num: AtomicU64,

/// A channel to tell consensus to reconfigure.
tx_reconfigure_consensus: Sender<ReconfigConsensusMessage>,
}
Expand Down Expand Up @@ -1251,7 +1248,6 @@ impl AuthorityState {
),
consensus_guardrail: AtomicUsize::new(0),
metrics: Arc::new(AuthorityMetrics::new(prometheus_registry)),
latest_checkpoint_num: AtomicU64::new(0),
tx_reconfigure_consensus,
};

Expand Down Expand Up @@ -2010,10 +2006,6 @@ impl ExecutionState for AuthorityState {
// to persist the consensus index. If the validator crashes, this transaction
// may be resent to the checkpoint logic that will simply ignore it.

// Cache the next checkpoint number if it changes.
self.latest_checkpoint_num
.store(checkpoint.next_checkpoint(), Ordering::Relaxed);

// TODO: At this point we should know whether we want to change epoch. If we do,
// we should have (i) the new committee and (ii) the new keypair of this authority.
// We then call:
Expand Down

0 comments on commit a677c26

Please sign in to comment.