Skip to content

Commit d784aa1

Browse files
committed
ff cleanup: enable_tower_sync_ix
1 parent cd2aa1b commit d784aa1

File tree

2 files changed

+9
-44
lines changed

2 files changed

+9
-44
lines changed

core/src/consensus.rs

+9-29
Original file line numberDiff line numberDiff line change
@@ -622,37 +622,18 @@ impl Tower {
622622
// here that this is our leader bank.
623623
Hash::default()
624624
});
625-
self.record_bank_vote_and_update_lockouts(
626-
bank.slot(),
627-
bank.hash(),
628-
bank.feature_set
629-
.is_active(&solana_feature_set::enable_tower_sync_ix::id()),
630-
block_id,
631-
)
625+
self.record_bank_vote_and_update_lockouts(bank.slot(), bank.hash(), block_id)
632626
}
633627

634628
/// If we've recently updated the vote state by applying a new vote
635629
/// or syncing from a bank, generate the proper last_vote.
636-
pub(crate) fn update_last_vote_from_vote_state(
637-
&mut self,
638-
vote_hash: Hash,
639-
enable_tower_sync_ix: bool,
640-
block_id: Hash,
641-
) {
642-
let mut new_vote = if enable_tower_sync_ix {
643-
VoteTransaction::from(TowerSync::new(
644-
self.vote_state.votes.clone(),
645-
self.vote_state.root_slot,
646-
vote_hash,
647-
block_id,
648-
))
649-
} else {
650-
VoteTransaction::from(VoteStateUpdate::new(
651-
self.vote_state.votes.clone(),
652-
self.vote_state.root_slot,
653-
vote_hash,
654-
))
655-
};
630+
pub(crate) fn update_last_vote_from_vote_state(&mut self, vote_hash: Hash, block_id: Hash) {
631+
let mut new_vote = VoteTransaction::from(TowerSync::new(
632+
self.vote_state.votes.clone(),
633+
self.vote_state.root_slot,
634+
vote_hash,
635+
block_id,
636+
));
656637

657638
new_vote.set_timestamp(self.maybe_timestamp(self.last_voted_slot().unwrap_or_default()));
658639
self.last_vote = new_vote;
@@ -662,7 +643,6 @@ impl Tower {
662643
&mut self,
663644
vote_slot: Slot,
664645
vote_hash: Hash,
665-
enable_tower_sync_ix: bool,
666646
block_id: Hash,
667647
) -> Option<Slot> {
668648
if let Some(last_voted_slot) = self.vote_state.last_voted_slot() {
@@ -680,7 +660,7 @@ impl Tower {
680660
let old_root = self.root();
681661

682662
self.vote_state.process_next_vote_slot(vote_slot);
683-
self.update_last_vote_from_vote_state(vote_hash, enable_tower_sync_ix, block_id);
663+
self.update_last_vote_from_vote_state(vote_hash, block_id);
684664

685665
let new_root = self.root();
686666

programs/vote/src/vote_processor.rs

-15
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ declare_process_instruction!(Entrypoint, DEFAULT_COMPUTE_UNITS, |invoke_context|
134134
if invoke_context
135135
.get_feature_set()
136136
.is_active(&feature_set::deprecate_legacy_vote_ixs::id())
137-
&& invoke_context
138-
.get_feature_set()
139-
.is_active(&feature_set::enable_tower_sync_ix::id())
140137
{
141138
return Err(InstructionError::InvalidInstructionData);
142139
}
@@ -158,9 +155,6 @@ declare_process_instruction!(Entrypoint, DEFAULT_COMPUTE_UNITS, |invoke_context|
158155
if invoke_context
159156
.get_feature_set()
160157
.is_active(&feature_set::deprecate_legacy_vote_ixs::id())
161-
&& invoke_context
162-
.get_feature_set()
163-
.is_active(&feature_set::enable_tower_sync_ix::id())
164158
{
165159
return Err(InstructionError::InvalidInstructionData);
166160
}
@@ -181,9 +175,6 @@ declare_process_instruction!(Entrypoint, DEFAULT_COMPUTE_UNITS, |invoke_context|
181175
if invoke_context
182176
.get_feature_set()
183177
.is_active(&feature_set::deprecate_legacy_vote_ixs::id())
184-
&& invoke_context
185-
.get_feature_set()
186-
.is_active(&feature_set::enable_tower_sync_ix::id())
187178
{
188179
return Err(InstructionError::InvalidInstructionData);
189180
}
@@ -201,12 +192,6 @@ declare_process_instruction!(Entrypoint, DEFAULT_COMPUTE_UNITS, |invoke_context|
201192
}
202193
VoteInstruction::TowerSync(tower_sync)
203194
| VoteInstruction::TowerSyncSwitch(tower_sync, _) => {
204-
if !invoke_context
205-
.get_feature_set()
206-
.is_active(&feature_set::enable_tower_sync_ix::id())
207-
{
208-
return Err(InstructionError::InvalidInstructionData);
209-
}
210195
let sysvar_cache = invoke_context.get_sysvar_cache();
211196
let slot_hashes = sysvar_cache.get_slot_hashes()?;
212197
let clock = sysvar_cache.get_clock()?;

0 commit comments

Comments
 (0)