@@ -15,11 +15,13 @@ use {
15
15
streamer:: StakedNodes ,
16
16
} ,
17
17
solana_tpu_client_next:: {
18
- connection_workers_scheduler:: { ConnectionWorkersSchedulerConfig , Fanout } ,
18
+ connection_workers_scheduler:: {
19
+ ConnectionWorkersSchedulerConfig , Fanout , TransactionStatsAndReceiver ,
20
+ } ,
19
21
leader_updater:: create_leader_updater,
20
22
send_transaction_stats:: SendTransactionStatsNonAtomic ,
21
23
transaction_batch:: TransactionBatch ,
22
- ConnectionWorkersScheduler , ConnectionWorkersSchedulerError , SendTransactionStatsPerAddr ,
24
+ ConnectionWorkersScheduler , ConnectionWorkersSchedulerError ,
23
25
} ,
24
26
std:: {
25
27
collections:: HashMap ,
@@ -40,10 +42,10 @@ use {
40
42
tokio_util:: sync:: CancellationToken ,
41
43
} ;
42
44
43
- fn test_config ( validator_identity : Option < Keypair > ) -> ConnectionWorkersSchedulerConfig {
45
+ fn test_config ( identity : Option < Keypair > ) -> ConnectionWorkersSchedulerConfig {
44
46
ConnectionWorkersSchedulerConfig {
45
47
bind : SocketAddr :: new ( Ipv4Addr :: new ( 127 , 0 , 0 , 1 ) . into ( ) , 0 ) ,
46
- stake_identity : validator_identity ,
48
+ identity ,
47
49
num_connections : 1 ,
48
50
skip_check_transaction_age : false ,
49
51
// At the moment we have only one strategy to send transactions: we try
@@ -63,9 +65,9 @@ fn test_config(validator_identity: Option<Keypair>) -> ConnectionWorkersSchedule
63
65
async fn setup_connection_worker_scheduler (
64
66
tpu_address : SocketAddr ,
65
67
transaction_receiver : Receiver < TransactionBatch > ,
66
- validator_identity : Option < Keypair > ,
68
+ identity : Option < Keypair > ,
67
69
) -> (
68
- JoinHandle < Result < SendTransactionStatsPerAddr , ConnectionWorkersSchedulerError > > ,
70
+ JoinHandle < Result < TransactionStatsAndReceiver , ConnectionWorkersSchedulerError > > ,
69
71
CancellationToken ,
70
72
) {
71
73
let json_rpc_url = "http://127.0.0.1:8899" ;
@@ -82,7 +84,7 @@ async fn setup_connection_worker_scheduler(
82
84
. expect ( "Leader updates was successfully created" ) ;
83
85
84
86
let cancel = CancellationToken :: new ( ) ;
85
- let config = test_config ( validator_identity ) ;
87
+ let config = test_config ( identity ) ;
86
88
let scheduler = tokio:: spawn ( ConnectionWorkersScheduler :: run (
87
89
config,
88
90
leader_updater,
@@ -95,10 +97,10 @@ async fn setup_connection_worker_scheduler(
95
97
96
98
async fn join_scheduler (
97
99
scheduler_handle : JoinHandle <
98
- Result < SendTransactionStatsPerAddr , ConnectionWorkersSchedulerError > ,
100
+ Result < TransactionStatsAndReceiver , ConnectionWorkersSchedulerError > ,
99
101
> ,
100
102
) -> SendTransactionStatsNonAtomic {
101
- let stats_per_ip = scheduler_handle
103
+ let ( stats_per_ip, _ ) = scheduler_handle
102
104
. await
103
105
. unwrap ( )
104
106
. expect ( "Scheduler should stop successfully." ) ;
@@ -400,8 +402,8 @@ async fn test_connection_pruned_and_reopened() {
400
402
/// connection and verify that all the txs has been received.
401
403
#[ tokio:: test]
402
404
async fn test_staked_connection ( ) {
403
- let validator_identity = Keypair :: new ( ) ;
404
- let stakes = HashMap :: from ( [ ( validator_identity . pubkey ( ) , 100_000 ) ] ) ;
405
+ let identity = Keypair :: new ( ) ;
406
+ let stakes = HashMap :: from ( [ ( identity . pubkey ( ) , 100_000 ) ] ) ;
405
407
let staked_nodes = StakedNodes :: new ( Arc :: new ( stakes) , HashMap :: < Pubkey , u64 > :: default ( ) ) ;
406
408
407
409
let SpawnTestServerResult {
@@ -432,8 +434,7 @@ async fn test_staked_connection() {
432
434
} = spawn_tx_sender ( tx_size, expected_num_txs, Duration :: from_millis ( 100 ) ) ;
433
435
434
436
let ( scheduler_handle, _scheduler_cancel) =
435
- setup_connection_worker_scheduler ( server_address, tx_receiver, Some ( validator_identity) )
436
- . await ;
437
+ setup_connection_worker_scheduler ( server_address, tx_receiver, Some ( identity) ) . await ;
437
438
438
439
// Check results
439
440
let actual_num_packets = count_received_packets_for ( receiver, tx_size, TEST_MAX_TIME ) . await ;
@@ -533,7 +534,7 @@ async fn test_no_host() {
533
534
534
535
// While attempting to establish a connection with a nonexistent host, we fill the worker's
535
536
// channel.
536
- let stats = scheduler_handle
537
+ let ( stats, _ ) = scheduler_handle
537
538
. await
538
539
. expect ( "Scheduler should stop successfully" )
539
540
. expect ( "Scheduler execution was successful" ) ;
0 commit comments