rename and change capacity on unprocessed transaction storage - max_receive_size (#28586)

This commit is contained in:
apfitzge 2022-10-26 10:03:47 -05:00 committed by GitHub
parent feb5ab4ba0
commit 340d3b5468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 9 deletions

View File

@ -1943,7 +1943,7 @@ impl BankingStage {
failed_sigverify_count,
} = packet_deserializer.handle_received_packets(
recv_timeout,
unprocessed_transaction_storage.capacity() - unprocessed_transaction_storage.len(),
unprocessed_transaction_storage.max_receive_size(),
)?;
let packet_count = deserialized_packets.len();
debug!(

View File

@ -23,7 +23,8 @@ use {
};
pub const UNPROCESSED_BUFFER_STEP_SIZE: usize = 128;
const MAX_STAKED_VALIDATORS: usize = 10_000;
/// Maximum numer of votes a single receive call will accept
const MAX_NUM_VOTES_RECEIVE: usize = 10_000;
#[derive(Debug)]
pub enum UnprocessedTransactionStorage {
@ -153,10 +154,13 @@ impl UnprocessedTransactionStorage {
}
}
pub fn capacity(&self) -> usize {
/// Returns the maximum number of packets a receive should accept
pub fn max_receive_size(&self) -> usize {
match self {
Self::VoteStorage(vote_storage) => vote_storage.capacity(),
Self::LocalTransactionStorage(transaction_storage) => transaction_storage.capacity(),
Self::VoteStorage(vote_storage) => vote_storage.max_receive_size(),
Self::LocalTransactionStorage(transaction_storage) => {
transaction_storage.max_receive_size()
}
}
}
@ -258,8 +262,8 @@ impl VoteStorage {
self.latest_unprocessed_votes.len()
}
fn capacity(&self) -> usize {
MAX_STAKED_VALIDATORS
fn max_receive_size(&self) -> usize {
MAX_NUM_VOTES_RECEIVE
}
fn forward_option(&self) -> ForwardOption {
@ -357,8 +361,8 @@ impl ThreadLocalUnprocessedPackets {
self.unprocessed_packet_batches.len()
}
fn capacity(&self) -> usize {
self.unprocessed_packet_batches.capacity()
fn max_receive_size(&self) -> usize {
self.unprocessed_packet_batches.capacity() - self.unprocessed_packet_batches.len()
}
#[cfg(test)]