rpc-send-tx-svc: add with_config constructor

This commit is contained in:
Trent Nelson
2021-10-19 17:11:46 -06:00
committed by Trent Nelson
parent 95e91a4863
commit fe098b5ddc
10 changed files with 109 additions and 59 deletions

View File

@ -34,7 +34,7 @@ use {
exit::Exit, genesis_config::DEFAULT_GENESIS_DOWNLOAD_PATH, hash::Hash,
native_token::lamports_to_sol, pubkey::Pubkey,
},
solana_send_transaction_service::send_transaction_service::SendTransactionService,
solana_send_transaction_service::send_transaction_service::{self, SendTransactionService},
std::{
collections::HashSet,
net::SocketAddr,
@ -297,8 +297,7 @@ impl JsonRpcService {
trusted_validators: Option<HashSet<Pubkey>>,
override_health_check: Arc<AtomicBool>,
optimistically_confirmed_bank: Arc<RwLock<OptimisticallyConfirmedBank>>,
send_transaction_retry_ms: u64,
send_transaction_leader_forward_count: u64,
send_transaction_service_config: send_transaction_service::Config,
max_slots: Arc<MaxSlots>,
leader_schedule_cache: Arc<LeaderScheduleCache>,
current_transaction_status_slot: Arc<AtomicU64>,
@ -395,13 +394,12 @@ impl JsonRpcService {
let leader_info =
poh_recorder.map(|recorder| ClusterTpuInfo::new(cluster_info.clone(), recorder));
let _send_transaction_service = Arc::new(SendTransactionService::new(
let _send_transaction_service = Arc::new(SendTransactionService::new_with_config(
tpu_address,
&bank_forks,
leader_info,
receiver,
send_transaction_retry_ms,
send_transaction_leader_forward_count,
send_transaction_service_config,
));
#[cfg(test)]
@ -557,8 +555,11 @@ mod tests {
None,
Arc::new(AtomicBool::new(false)),
optimistically_confirmed_bank,
1000,
1,
send_transaction_service::Config {
retry_rate_ms: 1000,
leader_forward_count: 1,
..send_transaction_service::Config::default()
},
Arc::new(MaxSlots::default()),
Arc::new(LeaderScheduleCache::default()),
Arc::new(AtomicU64::default()),