Do not exclude failed simple vote transactions from consensus

This commit is contained in:
Michael Vines 2022-06-11 23:01:07 -07:00
parent 30828609dc
commit b4237f3f2c
2 changed files with 10 additions and 10 deletions

View File

@ -3536,15 +3536,13 @@ pub mod tests {
// Create an transaction that references the new blockhash, should still // Create an transaction that references the new blockhash, should still
// be able to find the blockhash if we process transactions all in the same // be able to find the blockhash if we process transactions all in the same
// batch // batch
let mut expected_successful_voter_pubkeys = BTreeSet::new(); let mut expected_signatures = BTreeSet::new();
let vote_txs: Vec<_> = validator_keypairs let vote_txs: Vec<_> = validator_keypairs
.iter() .iter()
.enumerate() .enumerate()
.map(|(i, validator_keypairs)| { .map(|(i, validator_keypairs)| {
if i % 3 == 0 { let vote_tx = if i % 3 == 0 {
// These votes are correct // These votes are correct
expected_successful_voter_pubkeys
.insert(validator_keypairs.vote_keypair.pubkey());
vote_transaction::new_vote_transaction( vote_transaction::new_vote_transaction(
vec![0], vec![0],
bank0.hash(), bank0.hash(),
@ -3576,18 +3574,20 @@ pub mod tests {
&validator_keypairs.vote_keypair, &validator_keypairs.vote_keypair,
None, None,
) )
} };
expected_signatures.insert(vote_tx.signatures[0]);
vote_tx
}) })
.collect(); .collect();
let entry = next_entry(&bank_1_blockhash, 1, vote_txs); let entry = next_entry(&bank_1_blockhash, 1, vote_txs);
let (replay_vote_sender, replay_vote_receiver) = crossbeam_channel::unbounded(); let (replay_vote_sender, replay_vote_receiver) = crossbeam_channel::unbounded();
let _ = let _ =
process_entries_for_tests(&bank1, vec![entry], true, None, Some(&replay_vote_sender)); process_entries_for_tests(&bank1, vec![entry], true, None, Some(&replay_vote_sender));
let successes: BTreeSet<Pubkey> = replay_vote_receiver let signatures: BTreeSet<_> = replay_vote_receiver
.try_iter() .try_iter()
.map(|(vote_pubkey, ..)| vote_pubkey) .map(|(.., signature)| signature)
.collect(); .collect();
assert_eq!(successes, expected_successful_voter_pubkeys); assert_eq!(signatures, expected_signatures);
} }
fn make_slot_with_vote_tx( fn make_slot_with_vote_tx(

View File

@ -43,8 +43,8 @@ pub fn find_and_send_votes(
sanitized_txs sanitized_txs
.iter() .iter()
.zip(execution_results.iter()) .zip(execution_results.iter())
.for_each(|(tx, result)| { .for_each(|(tx, _result)| {
if tx.is_simple_vote_transaction() && result.was_executed_successfully() { if tx.is_simple_vote_transaction() {
if let Some(parsed_vote) = vote_parser::parse_sanitized_vote_transaction(tx) { if let Some(parsed_vote) = vote_parser::parse_sanitized_vote_transaction(tx) {
if parsed_vote.1.last_voted_slot().is_some() { if parsed_vote.1.last_voted_slot().is_some() {
let _ = vote_sender.send(parsed_vote); let _ = vote_sender.send(parsed_vote);