Add vote instructions that directly update on chain vote state (#21531)

* Add vote state instructions

UpdateVoteState and UpdateVoteStateSwitch

* cargo tree

* extract vote state version conversion to common fn
This commit is contained in:
Ashwin Sekar
2021-12-07 16:47:26 -08:00
committed by GitHub
parent 1df88837c8
commit f0acf7681e
18 changed files with 591 additions and 103 deletions

View File

@ -6146,7 +6146,10 @@ pub fn is_simple_vote_transaction(transaction: &SanitizedTransaction) -> bool {
{
return matches!(
vote_instruction,
VoteInstruction::Vote(_) | VoteInstruction::VoteSwitch(_, _)
VoteInstruction::Vote(_)
| VoteInstruction::VoteSwitch(_, _)
| VoteInstruction::UpdateVoteState(_)
| VoteInstruction::UpdateVoteStateSwitch(_, _)
);
}
}

View File

@ -48,7 +48,7 @@ pub fn find_and_send_votes(
if let Some(parsed_vote) =
vote_transaction::parse_sanitized_vote_transaction(tx)
{
if parsed_vote.1.slots.last().is_some() {
if parsed_vote.1.last_voted_slot().is_some() {
let _ = vote_sender.send(parsed_vote);
}
}

View File

@ -1,9 +1,7 @@
use {
crossbeam_channel::{Receiver, Sender},
solana_sdk::{hash::Hash, pubkey::Pubkey},
solana_vote_program::vote_state::Vote,
solana_vote_program::vote_transaction::ParsedVote,
};
pub type ReplayedVote = (Pubkey, Vote, Option<Hash>);
pub type ReplayVoteSender = Sender<ReplayedVote>;
pub type ReplayVoteReceiver = Receiver<ReplayedVote>;
pub type ReplayVoteSender = Sender<ParsedVote>;
pub type ReplayVoteReceiver = Receiver<ParsedVote>;