-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding custom tpu send transaction example (#380)
* Adding an example for custom tpu send transaction * Fixing the custom tpu example * Optimizing SentTransactionInfo, and calculating TPS * Reverting unwanted changes * After groovies review
- Loading branch information
1 parent
4d77001
commit 6813341
Showing
19 changed files
with
667 additions
and
57 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::time::Duration; | ||
|
||
use log::debug; | ||
use solana_sdk::commitment_config::CommitmentConfig; | ||
use tokio::time::{timeout, Instant}; | ||
|
||
use crate::{structures::block_info::BlockInfo, types::BlockInfoStream}; | ||
|
||
pub async fn wait_till_block_of_commitment_is_recieved( | ||
mut blockinfo_stream: BlockInfoStream, | ||
commitment_config: CommitmentConfig, | ||
) -> BlockInfo { | ||
let started = Instant::now(); | ||
loop { | ||
match timeout(Duration::from_millis(1000), blockinfo_stream.recv()).await { | ||
Ok(Ok(block_info)) => { | ||
if block_info.commitment_config == commitment_config { | ||
return block_info; | ||
} | ||
} | ||
Err(_elapsed) => { | ||
debug!( | ||
"waiting for latest block info ({}) ... {:.02}ms", | ||
commitment_config.commitment, | ||
started.elapsed().as_secs_f32() * 1000.0 | ||
); | ||
} | ||
Ok(Err(error)) => { | ||
panic!("Did not recv block info : {error:?}"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use clap::Parser; | ||
|
||
#[derive(Parser, Debug, Clone)] | ||
#[command(author, version, about, long_about = None)] | ||
pub struct Args { | ||
/// config.json | ||
#[arg(short, long, default_value = "http://127.0.0.1:8899")] | ||
pub rpc_url: String, | ||
|
||
#[arg(short, long)] | ||
pub grpc_url: Option<String>, | ||
|
||
#[arg(short, long)] | ||
pub x_token: Option<String>, | ||
|
||
#[arg(short, long)] | ||
pub transaction_count: Option<usize>, | ||
|
||
#[arg(short, long, default_value_t = 1)] | ||
pub number_of_seconds: usize, | ||
|
||
#[arg(short, long)] | ||
pub fee_payer: String, | ||
|
||
#[arg(short, long)] | ||
pub staked_identity: Option<String>, | ||
|
||
#[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>, | ||
} |
Oops, something went wrong.