changes after review of kirill and ilya
This commit is contained in:
parent
31cbd96897
commit
898059d81e
66
src/cli.rs
66
src/cli.rs
|
@ -1,8 +1,6 @@
|
|||
use solana_clap_utils::input_validators::is_valid_percentage;
|
||||
|
||||
use {
|
||||
clap::{crate_description, crate_name, App, Arg, ArgMatches},
|
||||
solana_clap_utils::input_validators::{is_url, is_url_or_moniker},
|
||||
solana_clap_utils::input_validators::{is_url, is_url_or_moniker, is_valid_percentage},
|
||||
solana_cli_config::{ConfigInput, CONFIG_FILE},
|
||||
solana_sdk::signature::{read_keypair_file, Keypair},
|
||||
std::{net::SocketAddr, process::exit, time::Duration},
|
||||
|
@ -23,7 +21,7 @@ pub struct Config {
|
|||
pub mango_cluster: String,
|
||||
pub txs_batch_size: Option<usize>,
|
||||
pub priority_fees_proba: u8,
|
||||
pub authority: Keypair,
|
||||
pub keeper_authority: Option<Keypair>,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
|
@ -42,7 +40,7 @@ impl Default for Config {
|
|||
mango_cluster: "testnet.0".to_string(),
|
||||
txs_batch_size: None,
|
||||
priority_fees_proba: 0,
|
||||
authority: Keypair::new(),
|
||||
keeper_authority: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +51,7 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
|
|||
.about(crate_description!())
|
||||
.version(version)
|
||||
.arg({
|
||||
let arg = Arg::with_name("config_file")
|
||||
let arg = Arg::with_name("config-file")
|
||||
.short("C")
|
||||
.long("config")
|
||||
.value_name("FILEPATH")
|
||||
|
@ -67,7 +65,7 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
|
|||
}
|
||||
})
|
||||
.arg(
|
||||
Arg::with_name("json_rpc_url")
|
||||
Arg::with_name("json-rpc-url")
|
||||
.short("u")
|
||||
.long("url")
|
||||
.value_name("URL_OR_MONIKER")
|
||||
|
@ -80,7 +78,7 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
|
|||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("websocket_url")
|
||||
Arg::with_name("websocket-url")
|
||||
.long("ws")
|
||||
.value_name("URL")
|
||||
.takes_value(true)
|
||||
|
@ -102,9 +100,9 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
|
|||
Arg::with_name("identity")
|
||||
.short("i")
|
||||
.long("identity")
|
||||
.value_name("PATH")
|
||||
.value_name("FILEPATH")
|
||||
.takes_value(true)
|
||||
.help("File containing a client identity (keypair)"),
|
||||
.help("Identity used to connect with QUIC connection, identity with lot of stakes have better chances to send transaction to the leader"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("duration")
|
||||
|
@ -115,15 +113,15 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
|
|||
.help("Seconds to run benchmark, then exit; default is forever"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("qoutes_per_second")
|
||||
Arg::with_name("quotes-per-second")
|
||||
.short("q")
|
||||
.long("qoutes_per_second")
|
||||
.long("quotes-per-second")
|
||||
.value_name("QPS")
|
||||
.takes_value(true)
|
||||
.help("Number of quotes per second"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("account_keys")
|
||||
Arg::with_name("account-keys")
|
||||
.short("a")
|
||||
.long("accounts")
|
||||
.value_name("FILENAME")
|
||||
|
@ -132,7 +130,7 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
|
|||
.help("Read account keys from JSON file generated with mango-client-v3"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("mango_keys")
|
||||
Arg::with_name("mango-keys")
|
||||
.short("m")
|
||||
.long("mango")
|
||||
.value_name("FILENAME")
|
||||
|
@ -141,18 +139,18 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
|
|||
.help("Read mango keys from JSON file generated with mango-client-v3"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("transaction_save_file")
|
||||
Arg::with_name("transaction-save-file")
|
||||
.short("tsf")
|
||||
.long("transaction_save_file")
|
||||
.long("transaction-save-file")
|
||||
.value_name("FILENAME")
|
||||
.takes_value(true)
|
||||
.required(false)
|
||||
.help("To save details of all transactions during a run"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("block_data_save_file")
|
||||
Arg::with_name("block-data-save-file")
|
||||
.short("bdsf")
|
||||
.long("block_data_save_file")
|
||||
.long("block-data-save-file")
|
||||
.value_name("FILENAME")
|
||||
.takes_value(true)
|
||||
.required(false)
|
||||
|
@ -188,7 +186,7 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
|
|||
Arg::with_name("keeper-authority")
|
||||
.long("keeper-authority")
|
||||
.short("ka")
|
||||
.value_name("STR")
|
||||
.value_name("FILEPATH")
|
||||
.takes_value(true)
|
||||
.required(false)
|
||||
.help(
|
||||
|
@ -205,21 +203,21 @@ pub fn build_args<'a, 'b>(version: &'b str) -> App<'a, 'b> {
|
|||
pub fn extract_args(matches: &ArgMatches) -> Config {
|
||||
let mut args = Config::default();
|
||||
|
||||
let config = if let Some(config_file) = matches.value_of("config_file") {
|
||||
let config = if let Some(config_file) = matches.value_of("config-file") {
|
||||
solana_cli_config::Config::load(config_file).unwrap_or_default()
|
||||
} else {
|
||||
solana_cli_config::Config::default()
|
||||
};
|
||||
let (_, json_rpc_url) = ConfigInput::compute_json_rpc_url_setting(
|
||||
matches.value_of("json_rpc_url").unwrap_or(""),
|
||||
matches.value_of("json-rpc-url").unwrap_or(""),
|
||||
&config.json_rpc_url,
|
||||
);
|
||||
args.json_rpc_url = json_rpc_url;
|
||||
|
||||
let (_, websocket_url) = ConfigInput::compute_websocket_url_setting(
|
||||
matches.value_of("websocket_url").unwrap_or(""),
|
||||
matches.value_of("websocket-url").unwrap_or(""),
|
||||
&config.websocket_url,
|
||||
matches.value_of("json_rpc_url").unwrap_or(""),
|
||||
matches.value_of("json-rpc-url").unwrap_or(""),
|
||||
&config.json_rpc_url,
|
||||
);
|
||||
args.websocket_url = websocket_url;
|
||||
|
@ -248,17 +246,17 @@ pub fn extract_args(matches: &ArgMatches) -> Config {
|
|||
);
|
||||
}
|
||||
|
||||
if let Some(qps) = matches.value_of("qoutes_per_second") {
|
||||
args.quotes_per_second = qps.parse().expect("can't parse qoutes_per_second");
|
||||
if let Some(qps) = matches.value_of("quotes-per-second") {
|
||||
args.quotes_per_second = qps.parse().expect("can't parse quotes-per-second");
|
||||
}
|
||||
|
||||
args.account_keys = matches.value_of("account_keys").unwrap().to_string();
|
||||
args.mango_keys = matches.value_of("mango_keys").unwrap().to_string();
|
||||
args.transaction_save_file = match matches.value_of("transaction_save_file") {
|
||||
args.account_keys = matches.value_of("account-keys").unwrap().to_string();
|
||||
args.mango_keys = matches.value_of("mango-keys").unwrap().to_string();
|
||||
args.transaction_save_file = match matches.value_of("transaction-save-file") {
|
||||
Some(x) => x.to_string(),
|
||||
None => String::new(),
|
||||
};
|
||||
args.block_data_save_file = match matches.value_of("block_data_save_file") {
|
||||
args.block_data_save_file = match matches.value_of("block-data-save-file") {
|
||||
Some(x) => x.to_string(),
|
||||
None => String::new(),
|
||||
};
|
||||
|
@ -272,7 +270,9 @@ pub fn extract_args(matches: &ArgMatches) -> Config {
|
|||
.map(|batch_size_str| batch_size_str.parse().expect("can't parse batch-size"));
|
||||
|
||||
args.priority_fees_proba = match matches.value_of("prioritization-fees") {
|
||||
Some(x) => x.parse().expect("Percentage of transactions having prioritization fees"),
|
||||
Some(x) => x
|
||||
.parse()
|
||||
.expect("Percentage of transactions having prioritization fees"),
|
||||
None => 0,
|
||||
};
|
||||
let (_, kp_auth_path) = ConfigInput::compute_keypair_path_setting(
|
||||
|
@ -280,10 +280,6 @@ pub fn extract_args(matches: &ArgMatches) -> Config {
|
|||
&config.keypair_path,
|
||||
);
|
||||
|
||||
if let Ok(kpa) = read_keypair_file(kp_auth_path) {
|
||||
args.authority = kpa;
|
||||
} else if matches.is_present("identity") {
|
||||
panic!("could not parse identity path");
|
||||
}
|
||||
args.keeper_authority = read_keypair_file(kp_auth_path.clone()).ok();
|
||||
args
|
||||
}
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
use std::{
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc, RwLock,
|
||||
use {
|
||||
iter_tools::Itertools,
|
||||
solana_client::tpu_client::TpuClient,
|
||||
solana_quic_client::{QuicConfig, QuicConnectionManager, QuicPool},
|
||||
solana_sdk::{
|
||||
compute_budget::ComputeBudgetInstruction, hash::Hash, instruction::Instruction,
|
||||
message::Message, signature::Keypair, signer::Signer, transaction::Transaction,
|
||||
},
|
||||
std::{
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc, RwLock,
|
||||
},
|
||||
thread::{Builder, JoinHandle},
|
||||
},
|
||||
thread::{Builder, JoinHandle},
|
||||
};
|
||||
|
||||
use solana_client::tpu_client::TpuClient;
|
||||
use solana_quic_client::{QuicConfig, QuicConnectionManager, QuicPool};
|
||||
use solana_sdk::{
|
||||
compute_budget::ComputeBudgetInstruction, hash::Hash, instruction::Instruction,
|
||||
message::Message, signature::Keypair, signer::Signer, transaction::Transaction,
|
||||
};
|
||||
|
||||
use crate::{helpers::to_sdk_instruction, states::PerpMarketCache};
|
||||
|
||||
fn create_root_bank_update_instructions(perp_markets: &Vec<PerpMarketCache>) -> Vec<Instruction> {
|
||||
fn create_root_bank_update_instructions(perp_markets: &[PerpMarketCache]) -> Vec<Instruction> {
|
||||
perp_markets
|
||||
.iter()
|
||||
.map(|perp_market| {
|
||||
|
@ -32,7 +34,7 @@ fn create_root_bank_update_instructions(perp_markets: &Vec<PerpMarketCache>) ->
|
|||
.collect()
|
||||
}
|
||||
|
||||
fn create_update_price_cache_instructions(perp_markets: &Vec<PerpMarketCache>) -> Vec<Instruction> {
|
||||
fn create_update_price_cache_instructions(perp_markets: &[PerpMarketCache]) -> Vec<Instruction> {
|
||||
perp_markets
|
||||
.iter()
|
||||
.map(|perp_market| {
|
||||
|
@ -48,6 +50,21 @@ fn create_update_price_cache_instructions(perp_markets: &Vec<PerpMarketCache>) -
|
|||
.collect()
|
||||
}
|
||||
|
||||
fn create_cache_perp_markets_instructions(perp_markets: &[PerpMarketCache]) -> Instruction {
|
||||
let mango_program_pk = perp_markets[0].mango_program_pk;
|
||||
let mango_group_pk = perp_markets[0].mango_group_pk;
|
||||
let mango_cache_pk = perp_markets[0].mango_cache_pk;
|
||||
let perp_market_pks = perp_markets.iter().map(|x| x.perp_market_pk).collect_vec();
|
||||
let ix = mango::instruction::cache_perp_markets(
|
||||
&mango_program_pk,
|
||||
&mango_group_pk,
|
||||
&mango_cache_pk,
|
||||
perp_market_pks.as_slice(),
|
||||
)
|
||||
.unwrap();
|
||||
to_sdk_instruction(ix)
|
||||
}
|
||||
|
||||
pub fn send_transaction(
|
||||
tpu_client: Arc<TpuClient<QuicPool, QuicConnectionManager, QuicConfig>>,
|
||||
ixs: &[Instruction],
|
||||
|
@ -55,13 +72,12 @@ pub fn send_transaction(
|
|||
payer: &Keypair,
|
||||
) {
|
||||
let mut tx = Transaction::new_unsigned(Message::new(ixs, Some(&payer.pubkey())));
|
||||
if let Ok(recent_blockhash) = blockhash.read() {
|
||||
tx.sign(&[payer], *recent_blockhash);
|
||||
}
|
||||
let recent_blockhash = blockhash.read().unwrap();
|
||||
tx.sign(&[payer], *recent_blockhash);
|
||||
tpu_client.send_transaction(&tx);
|
||||
}
|
||||
|
||||
pub fn start_root_bank_keeper(
|
||||
pub fn start_keepers(
|
||||
exit_signal: Arc<AtomicBool>,
|
||||
tpu_client: Arc<TpuClient<QuicPool, QuicConnectionManager, QuicConfig>>,
|
||||
perp_markets: Vec<PerpMarketCache>,
|
||||
|
@ -72,20 +88,17 @@ pub fn start_root_bank_keeper(
|
|||
Builder::new()
|
||||
.name("updating root bank keeper".to_string())
|
||||
.spawn(move || {
|
||||
let tpu_client = tpu_client.clone();
|
||||
let mut root_update_ixs = create_root_bank_update_instructions(&perp_markets);
|
||||
let mut cache_price = create_update_price_cache_instructions(&perp_markets);
|
||||
let update_perp_cache = create_cache_perp_markets_instructions(&perp_markets);
|
||||
|
||||
let blockhash = blockhash.clone();
|
||||
|
||||
// add prioritization instruction
|
||||
let prioritization_ix = ComputeBudgetInstruction::set_compute_unit_price(100);
|
||||
let prioritization_ix = ComputeBudgetInstruction::set_compute_unit_price(10000);
|
||||
root_update_ixs.insert(0, prioritization_ix.clone());
|
||||
cache_price.insert(0, prioritization_ix);
|
||||
loop {
|
||||
if exit_signal.load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
cache_price.insert(0, prioritization_ix.clone());
|
||||
while !exit_signal.load(Ordering::Relaxed) {
|
||||
send_transaction(
|
||||
tpu_client.clone(),
|
||||
root_update_ixs.as_slice(),
|
||||
|
@ -98,6 +111,14 @@ pub fn start_root_bank_keeper(
|
|||
blockhash.clone(),
|
||||
&authority,
|
||||
);
|
||||
|
||||
send_transaction(
|
||||
tpu_client.clone(),
|
||||
&[prioritization_ix.clone(), update_perp_cache.clone()],
|
||||
blockhash.clone(),
|
||||
&authority,
|
||||
);
|
||||
std::thread::sleep(std::time::Duration::from_secs(1));
|
||||
}
|
||||
})
|
||||
.unwrap()
|
||||
|
|
71
src/main.rs
71
src/main.rs
|
@ -1,29 +1,31 @@
|
|||
use log::{error, info};
|
||||
use serde_json;
|
||||
use solana_bench_mango::{
|
||||
cli,
|
||||
confirmation_strategies::confirmations_by_blocks,
|
||||
helpers::{
|
||||
get_latest_blockhash, get_mango_market_perps_cache, start_blockhash_polling_service,
|
||||
write_block_data_into_csv, write_transaction_data_into_csv,
|
||||
use {
|
||||
log::{error, info},
|
||||
serde_json,
|
||||
solana_bench_mango::{
|
||||
cli,
|
||||
confirmation_strategies::confirmations_by_blocks,
|
||||
helpers::{
|
||||
get_latest_blockhash, get_mango_market_perps_cache, start_blockhash_polling_service,
|
||||
write_block_data_into_csv, write_transaction_data_into_csv,
|
||||
},
|
||||
keeper::start_keepers,
|
||||
mango::{AccountKeys, MangoConfig},
|
||||
market_markers::start_market_making_threads,
|
||||
states::{BlockData, PerpMarketCache, TransactionConfirmRecord, TransactionSendRecord},
|
||||
},
|
||||
mango::{AccountKeys, MangoConfig},
|
||||
market_markers::start_market_making_threads,
|
||||
states::{BlockData, PerpMarketCache, TransactionConfirmRecord, TransactionSendRecord},
|
||||
};
|
||||
use solana_client::{
|
||||
connection_cache::ConnectionCache, rpc_client::RpcClient, tpu_client::TpuClient,
|
||||
};
|
||||
use solana_sdk::commitment_config::CommitmentConfig;
|
||||
|
||||
use std::{
|
||||
fs,
|
||||
net::{IpAddr, Ipv4Addr},
|
||||
sync::{
|
||||
atomic::{AtomicBool, AtomicU64, Ordering},
|
||||
Arc, RwLock,
|
||||
solana_client::{
|
||||
connection_cache::ConnectionCache, rpc_client::RpcClient, tpu_client::TpuClient,
|
||||
},
|
||||
solana_sdk::commitment_config::CommitmentConfig,
|
||||
std::{
|
||||
fs,
|
||||
net::{IpAddr, Ipv4Addr},
|
||||
sync::{
|
||||
atomic::{AtomicBool, AtomicU64, Ordering},
|
||||
Arc, RwLock,
|
||||
},
|
||||
thread::{Builder, JoinHandle},
|
||||
},
|
||||
thread::{Builder, JoinHandle},
|
||||
};
|
||||
|
||||
fn main() {
|
||||
|
@ -46,6 +48,7 @@ fn main() {
|
|||
mango_cluster,
|
||||
txs_batch_size,
|
||||
priority_fees_proba,
|
||||
keeper_authority,
|
||||
..
|
||||
} = &cli_config;
|
||||
|
||||
|
@ -128,6 +131,20 @@ fn main() {
|
|||
let perp_market_caches: Vec<PerpMarketCache> =
|
||||
get_mango_market_perps_cache(rpc_client.clone(), &mango_group_config);
|
||||
|
||||
// start keeper if keeper authority is present
|
||||
let keepers_jl = if let Some(keeper_authority) = keeper_authority {
|
||||
let jl = start_keepers(
|
||||
exit_signal.clone(),
|
||||
tpu_client.clone(),
|
||||
perp_market_caches.clone(),
|
||||
blockhash.clone(),
|
||||
keeper_authority,
|
||||
);
|
||||
Some(jl)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let (tx_record_sx, tx_record_rx) = crossbeam_channel::unbounded();
|
||||
|
||||
let mm_threads: Vec<JoinHandle<()>> = start_market_making_threads(
|
||||
|
@ -248,4 +265,10 @@ fn main() {
|
|||
if let Err(err) = blockhash_thread.join() {
|
||||
error!("blockhash join failed with: {:?}", err);
|
||||
}
|
||||
|
||||
if let Some(keepers_jl) = keepers_jl {
|
||||
if let Err(err) = keepers_jl.join() {
|
||||
error!("keeper join failed with: {:?}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,9 +46,8 @@ pub fn create_ask_bid_transaction(
|
|||
);
|
||||
let mut instructions = vec![];
|
||||
if prioritization_fee > 0 {
|
||||
let pfees = compute_budget::ComputeBudgetInstruction::set_compute_unit_price(
|
||||
prioritization_fee,
|
||||
);
|
||||
let pfees =
|
||||
compute_budget::ComputeBudgetInstruction::set_compute_unit_price(prioritization_fee);
|
||||
instructions.push(pfees);
|
||||
}
|
||||
|
||||
|
@ -129,7 +128,12 @@ pub fn create_ask_bid_transaction(
|
|||
))
|
||||
}
|
||||
|
||||
fn generate_random_fees(prioritization_fee_proba : u8, n: usize, min_fee: u64, max_fee: u64) -> Vec<u64> {
|
||||
fn generate_random_fees(
|
||||
prioritization_fee_proba: u8,
|
||||
n: usize,
|
||||
min_fee: u64,
|
||||
max_fee: u64,
|
||||
) -> Vec<u64> {
|
||||
let mut rng = rand::thread_rng();
|
||||
let range = Uniform::from(min_fee..max_fee);
|
||||
let range_probability = Uniform::from(1..100);
|
||||
|
@ -146,7 +150,7 @@ fn generate_random_fees(prioritization_fee_proba : u8, n: usize, min_fee: u64, m
|
|||
}
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_mm_transactions(
|
||||
quotes_per_second: u64,
|
||||
|
@ -162,8 +166,13 @@ pub fn send_mm_transactions(
|
|||
let mango_account_signer_pk = to_sp_pk(&mango_account_signer.pubkey());
|
||||
// update quotes 2x per second
|
||||
for _ in 0..quotes_per_second {
|
||||
let prioritization_fee_by_market = generate_random_fees(prioritization_fee_proba, perp_market_caches.len(), 100, 1000);
|
||||
for (i,c) in perp_market_caches.iter().enumerate() {
|
||||
let prioritization_fee_by_market = generate_random_fees(
|
||||
prioritization_fee_proba,
|
||||
perp_market_caches.len(),
|
||||
100,
|
||||
1000,
|
||||
);
|
||||
for (i, c) in perp_market_caches.iter().enumerate() {
|
||||
let prioritization_fee = prioritization_fee_by_market[i];
|
||||
let mut tx = create_ask_bid_transaction(
|
||||
c,
|
||||
|
@ -175,7 +184,7 @@ pub fn send_mm_transactions(
|
|||
if let Ok(recent_blockhash) = blockhash.read() {
|
||||
tx.sign(&[mango_account_signer], *recent_blockhash);
|
||||
}
|
||||
let tpu_client = tpu_client.clone();
|
||||
|
||||
tpu_client.send_transaction(&tx);
|
||||
let sent = tx_record_sx.send(TransactionSendRecord {
|
||||
signature: tx.signatures[0],
|
||||
|
@ -213,17 +222,19 @@ pub fn send_mm_transactions_batched(
|
|||
// update quotes 2x per second
|
||||
for _ in 0..quotes_per_second {
|
||||
for c in perp_market_caches.iter() {
|
||||
let prioritization_fee_for_tx = generate_random_fees(prioritization_fee_proba, txs_batch_size, 100, 1000);
|
||||
let prioritization_fee_for_tx =
|
||||
generate_random_fees(prioritization_fee_proba, txs_batch_size, 100, 1000);
|
||||
for i in 0..txs_batch_size {
|
||||
let prioritization_fee = prioritization_fee_for_tx[i];
|
||||
transactions.push(
|
||||
(create_ask_bid_transaction(
|
||||
transactions.push((
|
||||
create_ask_bid_transaction(
|
||||
c,
|
||||
mango_account_pk,
|
||||
&mango_account_signer,
|
||||
prioritization_fee,
|
||||
),prioritization_fee)
|
||||
);
|
||||
),
|
||||
prioritization_fee,
|
||||
));
|
||||
}
|
||||
|
||||
if let Ok(recent_blockhash) = blockhash.read() {
|
||||
|
@ -231,10 +242,14 @@ pub fn send_mm_transactions_batched(
|
|||
tx.0.sign(&[mango_account_signer], *recent_blockhash);
|
||||
}
|
||||
}
|
||||
let tpu_client = tpu_client.clone();
|
||||
|
||||
if tpu_client
|
||||
.try_send_transaction_batch(
|
||||
&transactions.iter().map(|x| x.0.clone()).collect_vec().as_slice(),
|
||||
&transactions
|
||||
.iter()
|
||||
.map(|x| x.0.clone())
|
||||
.collect_vec()
|
||||
.as_slice(),
|
||||
)
|
||||
.is_err()
|
||||
{
|
||||
|
@ -280,9 +295,6 @@ pub fn start_market_making_threads(
|
|||
.iter()
|
||||
.map(|account_keys| {
|
||||
let _exit_signal = exit_signal.clone();
|
||||
// having a tpu client for each MM
|
||||
let tpu_client_pool = tpu_client.clone();
|
||||
|
||||
let blockhash = blockhash.clone();
|
||||
let current_slot = current_slot.clone();
|
||||
let duration = duration.clone();
|
||||
|
@ -291,6 +303,7 @@ pub fn start_market_making_threads(
|
|||
Pubkey::from_str(account_keys.mango_account_pks[0].as_str()).unwrap();
|
||||
let mango_account_signer =
|
||||
Keypair::from_bytes(account_keys.secret_key.as_slice()).unwrap();
|
||||
let tpu_client = tpu_client.clone();
|
||||
|
||||
info!(
|
||||
"wallet:{:?} https://testnet.mango.markets/account?pubkey={:?}",
|
||||
|
@ -313,7 +326,7 @@ pub fn start_market_making_threads(
|
|||
quotes_per_second,
|
||||
&perp_market_caches,
|
||||
&tx_record_sx,
|
||||
tpu_client_pool.clone(),
|
||||
tpu_client.clone(),
|
||||
mango_account_pk,
|
||||
&mango_account_signer,
|
||||
blockhash.clone(),
|
||||
|
@ -325,7 +338,7 @@ pub fn start_market_making_threads(
|
|||
quotes_per_second,
|
||||
&perp_market_caches,
|
||||
&tx_record_sx,
|
||||
tpu_client_pool.clone(),
|
||||
tpu_client.clone(),
|
||||
mango_account_pk,
|
||||
&mango_account_signer,
|
||||
blockhash.clone(),
|
||||
|
|
Loading…
Reference in New Issue