Skip to content

Commit b9cd2de

Browse files
committed
fix(tower): incorrect prior fix invert comparison
1 parent 2903c2b commit b9cd2de

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/choreo/tower/fd_tower.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,8 @@ fd_tower_lockout_check( fd_tower_t const * tower,
115115
fd_tower_vote_t const * vote = fd_tower_votes_peek_index_const( tower, cnt - 1 );
116116
fd_ghost_ele_t const * root = fd_ghost_root_const( ghost );
117117

118-
int lockout_check = slot <= vote->slot ||
119-
vote->slot < root->slot ||
120-
fd_ghost_is_ancestor( ghost, fd_ghost_hash( ghost, vote->slot ), block_id );
118+
int lockout_check = (slot > vote->slot) &&
119+
(vote->slot < root->slot || fd_ghost_is_ancestor( ghost, fd_ghost_hash( ghost, vote->slot ), block_id ));
121120
FD_LOG_NOTICE(( "[fd_tower_lockout_check] ok? %d. top: (slot: %lu, conf: %lu). switch: %lu.", lockout_check, vote->slot, vote->conf, slot ));
122121
return lockout_check;
123122
}
@@ -356,7 +355,7 @@ fd_tower_vote_slot( fd_tower_t * tower,
356355
/* The ghost head is on the same fork as our last vote slot, so we
357356
can vote fork it as long as we pass the threshold check. */
358357

359-
if( FD_LIKELY( fd_tower_threshold_check( tower, epoch, funk, txn, head->slot, scratch ) ) ) {
358+
if( FD_LIKELY( head->slot > vote->slot && fd_tower_threshold_check( tower, epoch, funk, txn, head->slot, scratch ) ) ) {
360359
FD_LOG_DEBUG(( "[%s] success (threshold). best: %lu. vote: (slot: %lu conf: %lu)", __func__, head->slot, vote->slot, vote->conf ));
361360
return head->slot;
362361
}

src/choreo/tower/fd_tower.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ int
583583
fd_tower_lockout_check( fd_tower_t const * tower,
584584
fd_ghost_t const * ghost,
585585
ulong slot,
586-
fd_hash_t const * hash_id );
586+
fd_hash_t const * block_id );
587587

588588
/* fd_tower_switch_check checks if we can switch to the fork of `slot`.
589589
Returns 1 if we can switch, 0 otherwise. Assumes tower is non-empty.
@@ -618,7 +618,7 @@ fd_tower_switch_check( fd_tower_t const * tower,
618618
fd_epoch_t const * epoch,
619619
fd_ghost_t const * ghost,
620620
ulong slot,
621-
fd_hash_t const * hash_id );
621+
fd_hash_t const * block_id );
622622

623623
/* fd_tower_threshold_check checks if we pass the threshold required to
624624
vote for `slot`. This is only relevant after voting for (and

0 commit comments

Comments
 (0)