Refactor: move simple vote parsing to runtime (#22537)
This commit is contained in:
@ -25,8 +25,13 @@ use {
|
||||
rpc_subscriptions::RpcSubscriptions,
|
||||
},
|
||||
solana_runtime::{
|
||||
bank::Bank, bank_forks::BankForks, commitment::VOTE_THRESHOLD_SIZE,
|
||||
epoch_stakes::EpochStakes, vote_sender_types::ReplayVoteReceiver,
|
||||
bank::Bank,
|
||||
bank_forks::BankForks,
|
||||
commitment::VOTE_THRESHOLD_SIZE,
|
||||
epoch_stakes::EpochStakes,
|
||||
vote_parser::{self, ParsedVote},
|
||||
vote_sender_types::ReplayVoteReceiver,
|
||||
vote_transaction::VoteTransaction,
|
||||
},
|
||||
solana_sdk::{
|
||||
clock::{Slot, DEFAULT_MS_PER_SLOT, DEFAULT_TICKS_PER_SLOT},
|
||||
@ -36,10 +41,6 @@ use {
|
||||
slot_hashes,
|
||||
transaction::Transaction,
|
||||
},
|
||||
solana_vote_program::{
|
||||
vote_state::VoteTransaction,
|
||||
vote_transaction::{self, ParsedVote},
|
||||
},
|
||||
std::{
|
||||
collections::{HashMap, HashSet},
|
||||
iter::repeat,
|
||||
@ -308,7 +309,7 @@ impl ClusterInfoVoteListener {
|
||||
!packet_batch.packets[0].meta.discard()
|
||||
})
|
||||
.filter_map(|(tx, packet_batch)| {
|
||||
let (vote_account_key, vote, _) = vote_transaction::parse_vote_transaction(&tx)?;
|
||||
let (vote_account_key, vote, _) = vote_parser::parse_vote_transaction(&tx)?;
|
||||
let slot = vote.last_voted_slot()?;
|
||||
let epoch = epoch_schedule.get_epoch(slot);
|
||||
let authorized_voter = root_bank
|
||||
@ -705,7 +706,7 @@ impl ClusterInfoVoteListener {
|
||||
// Process votes from gossip and ReplayStage
|
||||
let votes = gossip_vote_txs
|
||||
.iter()
|
||||
.filter_map(vote_transaction::parse_vote_transaction)
|
||||
.filter_map(vote_parser::parse_vote_transaction)
|
||||
.zip(repeat(/*is_gossip:*/ true))
|
||||
.chain(replayed_votes.into_iter().zip(repeat(/*is_gossip:*/ false)));
|
||||
for ((vote_pubkey, vote, _), is_gossip) in votes {
|
||||
@ -823,7 +824,7 @@ mod tests {
|
||||
pubkey::Pubkey,
|
||||
signature::{Keypair, Signature, Signer},
|
||||
},
|
||||
solana_vote_program::vote_state::Vote,
|
||||
solana_vote_program::{vote_state::Vote, vote_transaction},
|
||||
std::{
|
||||
collections::BTreeSet,
|
||||
iter::repeat_with,
|
||||
|
@ -1,12 +1,11 @@
|
||||
use {
|
||||
crate::{cluster_info_vote_listener::VerifiedLabelVotePacketsReceiver, result::Result},
|
||||
solana_perf::packet::PacketBatch,
|
||||
solana_runtime::bank::Bank,
|
||||
solana_runtime::{bank::Bank, vote_transaction::VoteTransaction},
|
||||
solana_sdk::{
|
||||
account::from_account, clock::Slot, hash::Hash, pubkey::Pubkey, signature::Signature,
|
||||
slot_hashes::SlotHashes, sysvar,
|
||||
},
|
||||
solana_vote_program::vote_state::VoteTransaction,
|
||||
std::{
|
||||
collections::{BTreeMap, HashMap, HashSet},
|
||||
sync::Arc,
|
||||
|
Reference in New Issue
Block a user