Skip to content

Commit

Permalink
Optimizing SentTransactionInfo, and calculating TPS
Browse files Browse the repository at this point in the history
  • Loading branch information
godmodegalactus committed Apr 2, 2024
1 parent 64837a5 commit 3302997
Show file tree
Hide file tree
Showing 13 changed files with 306 additions and 49 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions core/src/structures/prioritization_fee_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl PrioritizationFeesHeap {
#[cfg(test)]
mod tests {
use solana_sdk::signature::Signature;
use std::time::Duration;
use std::{sync::Arc, time::Duration};

use crate::structures::{
prioritization_fee_heap::PrioritizationFeesHeap, transaction_sent_info::SentTransactionInfo,
Expand All @@ -139,7 +139,7 @@ mod tests {
let tx_creator = |signature, prioritization_fee| SentTransactionInfo {
signature,
slot: 0,
transaction: vec![],
transaction: Arc::new(vec![]),
last_valid_block_height: 0,
prioritization_fee,
};
Expand Down Expand Up @@ -205,7 +205,7 @@ mod tests {
let info = SentTransactionInfo {
signature: Signature::new_unique(),
slot: height + 1,
transaction: vec![],
transaction: Arc::new(vec![]),
last_valid_block_height: height + 10,
prioritization_fee,
};
Expand Down
4 changes: 3 additions & 1 deletion core/src/structures/transaction_sent_info.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::sync::Arc;

use solana_sdk::signature::Signature;
use solana_sdk::slot_history::Slot;

Expand All @@ -7,7 +9,7 @@ pub type WireTransaction = Vec<u8>;
pub struct SentTransactionInfo {
pub signature: Signature,
pub slot: Slot,
pub transaction: WireTransaction,
pub transaction: Arc<WireTransaction>,
pub last_valid_block_height: u64,
pub prioritization_fee: u64,
}
5 changes: 4 additions & 1 deletion examples/custom-tpu-send-transactions/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ dashmap = { workspace = true }
rand = "0.8.5"
rand_chacha = "0.3.1"
log = { workspace = true }
itertools = { workspace = true }
itertools = { workspace = true }
bincode = { workspace = true }
futures = { workspace = true }
tracing-subscriber = { workspace = true }
9 changes: 9 additions & 0 deletions examples/custom-tpu-send-transactions/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,13 @@ pub struct Args {

#[arg(short, long)]
pub priority_fees: Option<u64>,

#[arg(short = 'a', long, default_value_t = 256)]
pub additional_signers: usize,

#[arg(short = 'b', long, default_value_t = 0.1)]
pub signers_transfer_balance: f64,

#[arg(long)]
pub fanout_slots: Option<u64>,
}
Loading

0 comments on commit 3302997

Please sign in to comment.