diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index 098d506164..5399c3c388 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -77,7 +77,6 @@ use { transaction_batch::TransactionBatch, transaction_error_metrics::TransactionErrorMetrics, vote_account::{VoteAccount, VoteAccountsHashMap}, - vote_parser, }, byteorder::{ByteOrder, LittleEndian}, dashmap::{DashMap, DashSet}, @@ -4672,7 +4671,7 @@ impl Bank { } } - let is_vote = vote_parser::is_simple_vote_transaction(tx); + let is_vote = tx.is_simple_vote_transaction(); if execution_result.was_executed() // Skip log collection for unprocessed transactions && transaction_log_collector_config.filter != TransactionLogCollectorFilter::None diff --git a/runtime/src/vote_parser.rs b/runtime/src/vote_parser.rs index 814fb47a5b..4b4e12770e 100644 --- a/runtime/src/vote_parser.rs +++ b/runtime/src/vote_parser.rs @@ -12,24 +12,6 @@ use { pub type ParsedVote = (Pubkey, VoteTransaction, Option, Signature); -// Used for filtering out votes from the transaction log collector -pub(crate) fn is_simple_vote_transaction(transaction: &SanitizedTransaction) -> bool { - if transaction.message().instructions().len() == 1 { - let (program_pubkey, instruction) = transaction - .message() - .program_instructions_iter() - .next() - .unwrap(); - if program_pubkey == &solana_vote_program::id() { - if let Ok(vote_instruction) = limited_deserialize::(&instruction.data) - { - return vote_instruction.is_simple_vote(); - } - } - } - false -} - // Used for locally forwarding processed vote transactions to consensus pub fn parse_sanitized_vote_transaction(tx: &SanitizedTransaction) -> Option { // Check first instruction for a vote diff --git a/sdk/src/transaction/sanitized.rs b/sdk/src/transaction/sanitized.rs index cb2dfe838f..0064007790 100644 --- a/sdk/src/transaction/sanitized.rs +++ b/sdk/src/transaction/sanitized.rs @@ -117,9 +117,13 @@ impl SanitizedTransaction { }; let is_simple_vote_tx = is_simple_vote_tx.unwrap_or_else(|| { - // TODO: Move to `vote_parser` runtime module - let mut ix_iter = message.program_instructions_iter(); - ix_iter.next().map(|(program_id, _ix)| program_id) == Some(&crate::vote::program::id()) + if message.instructions().len() == 1 && matches!(message, SanitizedMessage::Legacy(_)) { + let mut ix_iter = message.program_instructions_iter(); + ix_iter.next().map(|(program_id, _ix)| program_id) + == Some(&crate::vote::program::id()) + } else { + false + } }); Ok(Self {