Skip to content

Commit ddcd466

Browse files
committed
Replace local highest_finalized_slot with pool.highest_finalized_slot. (anza-xyz#325)
1 parent fc2fb15 commit ddcd466

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

votor/src/certificate_pool_service.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,12 @@ impl CertificatePoolService {
8989
new_finalized_slot: Option<Slot>,
9090
new_certificates_to_send: Vec<Arc<CertificateMessage>>,
9191
current_root: &mut Slot,
92-
highest_finalized_slot: &mut Slot,
9392
standstill_timer: &mut Instant,
9493
stats: &mut CertificatePoolServiceStats,
9594
) -> Result<(), AddVoteError> {
9695
// If we have a new finalized slot, update the root and send new certificates
97-
if let Some(new_finalized_slot) = new_finalized_slot {
96+
if new_finalized_slot.is_some() {
9897
// Reset standstill timer
99-
debug_assert!(new_finalized_slot > *highest_finalized_slot);
100-
*highest_finalized_slot = new_finalized_slot;
10198
*standstill_timer = Instant::now();
10299
CertificatePoolServiceStats::incr_u16(&mut stats.new_finalized_slot);
103100
// Set root
@@ -145,7 +142,6 @@ impl CertificatePoolService {
145142
cert_pool: &mut CertificatePool,
146143
events: &mut Vec<VotorEvent>,
147144
current_root: &mut Slot,
148-
highest_finalized_slot: &mut Slot,
149145
standstill_timer: &mut Instant,
150146
stats: &mut CertificatePoolServiceStats,
151147
) -> Result<(), AddVoteError> {
@@ -173,7 +169,6 @@ impl CertificatePoolService {
173169
new_finalized_slot,
174170
new_certificates_to_send,
175171
current_root,
176-
highest_finalized_slot,
177172
standstill_timer,
178173
stats,
179174
)?;
@@ -211,7 +206,6 @@ impl CertificatePoolService {
211206

212207
// Standstill tracking
213208
let mut standstill_timer = Instant::now();
214-
let mut highest_finalized_slot = cert_pool.highest_finalized_slot();
215209

216210
// Kick off parent ready
217211
let root_bank = ctx.root_bank_cache.root_bank();
@@ -234,7 +228,7 @@ impl CertificatePoolService {
234228
);
235229

236230
if standstill_timer.elapsed() > STANDSTILL_TIMEOUT {
237-
events.push(VotorEvent::Standstill(highest_finalized_slot));
231+
events.push(VotorEvent::Standstill(cert_pool.highest_finalized_slot()));
238232
stats.standstill = true;
239233
standstill_timer = Instant::now();
240234
if Err(AddVoteError::VotingServiceSenderDisconnected)
@@ -281,7 +275,6 @@ impl CertificatePoolService {
281275
&mut cert_pool,
282276
&mut events,
283277
&mut current_root,
284-
&mut highest_finalized_slot,
285278
&mut standstill_timer,
286279
&mut stats,
287280
) {

0 commit comments

Comments
 (0)