Only allow votes when root distance gets too high (#19916)
This commit is contained in:
@@ -50,6 +50,7 @@ use solana_sdk::{
|
||||
use solana_transaction_status::token_balances::{
|
||||
collect_token_balances, TransactionTokenBalancesSet,
|
||||
};
|
||||
use solana_vote_program::vote_transaction;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
cmp,
|
||||
@@ -1025,12 +1026,16 @@ impl BankingStage {
|
||||
msgs: &Packets,
|
||||
transaction_indexes: &[usize],
|
||||
libsecp256k1_0_5_upgrade_enabled: bool,
|
||||
votes_only: bool,
|
||||
) -> (Vec<HashedTransaction<'static>>, Vec<usize>) {
|
||||
transaction_indexes
|
||||
.iter()
|
||||
.filter_map(|tx_index| {
|
||||
let p = &msgs.packets[*tx_index];
|
||||
let tx: Transaction = limited_deserialize(&p.data[0..p.meta.size]).ok()?;
|
||||
if votes_only && vote_transaction::parse_vote_transaction(&tx).is_none() {
|
||||
return None;
|
||||
}
|
||||
tx.verify_precompiles(libsecp256k1_0_5_upgrade_enabled)
|
||||
.ok()?;
|
||||
let message_bytes = Self::packet_message(p)?;
|
||||
@@ -1097,6 +1102,7 @@ impl BankingStage {
|
||||
msgs,
|
||||
&packet_indexes,
|
||||
bank.libsecp256k1_0_5_upgrade_enabled(),
|
||||
bank.vote_only_bank(),
|
||||
);
|
||||
packet_conversion_time.stop();
|
||||
|
||||
@@ -1168,6 +1174,7 @@ impl BankingStage {
|
||||
msgs,
|
||||
&transaction_indexes,
|
||||
bank.libsecp256k1_0_5_upgrade_enabled(),
|
||||
false,
|
||||
);
|
||||
|
||||
let tx_count = transaction_to_packet_indexes.len();
|
||||
|
@@ -1227,12 +1227,15 @@ impl ReplayStage {
|
||||
poh_slot, parent_slot, root_slot
|
||||
);
|
||||
|
||||
let root_distance = poh_slot - root_slot;
|
||||
|
||||
let tpu_bank = Self::new_bank_from_parent_with_notify(
|
||||
&parent,
|
||||
poh_slot,
|
||||
root_slot,
|
||||
my_pubkey,
|
||||
subscriptions,
|
||||
root_distance > 500,
|
||||
);
|
||||
|
||||
let tpu_bank = bank_forks.write().unwrap().insert(tpu_bank);
|
||||
@@ -2489,6 +2492,7 @@ impl ReplayStage {
|
||||
forks.root(),
|
||||
&leader,
|
||||
subscriptions,
|
||||
false,
|
||||
);
|
||||
let empty: Vec<Pubkey> = vec![];
|
||||
Self::update_fork_propagated_threshold_from_votes(
|
||||
@@ -2515,9 +2519,10 @@ impl ReplayStage {
|
||||
root_slot: u64,
|
||||
leader: &Pubkey,
|
||||
subscriptions: &Arc<RpcSubscriptions>,
|
||||
vote_only_bank: bool,
|
||||
) -> Bank {
|
||||
subscriptions.notify_slot(slot, parent.slot(), root_slot);
|
||||
Bank::new_from_parent(parent, leader, slot)
|
||||
Bank::new_from_parent_with_vote_only(parent, leader, slot, vote_only_bank)
|
||||
}
|
||||
|
||||
fn record_rewards(bank: &Bank, rewards_recorder_sender: &Option<RewardsRecorderSender>) {
|
||||
|
Reference in New Issue
Block a user