@@ -70,7 +70,7 @@ pub struct ConnectionWorkersSchedulerConfig {
70
70
71
71
/// Optional stake identity keypair used in the endpoint certificate for
72
72
/// identifying the sender.
73
- pub identity : Option < Keypair > ,
73
+ pub stake_identity : Option < Keypair > ,
74
74
75
75
/// The number of connections to be maintained by the scheduler.
76
76
pub num_connections : usize ,
@@ -101,14 +101,17 @@ impl ConnectionWorkersScheduler {
101
101
///
102
102
/// Runs the main loop that handles worker scheduling and management for
103
103
/// connections. Returns the error quic statistics per connection address or
104
- /// an error.
104
+ /// an error along with receiver for transactions. The receiver returned
105
+ /// back to the user because in some cases we need to re-utilize the same
106
+ /// receiver for the new scheduler. For example, this happens when the
107
+ /// identity for the validator is updated.
105
108
///
106
109
/// Importantly, if some transactions were not delivered due to network
107
110
/// problems, they will not be retried when the problem is resolved.
108
111
pub async fn run (
109
112
ConnectionWorkersSchedulerConfig {
110
113
bind,
111
- identity ,
114
+ stake_identity ,
112
115
num_connections,
113
116
skip_check_transaction_age,
114
117
worker_channel_size,
@@ -119,7 +122,7 @@ impl ConnectionWorkersScheduler {
119
122
mut transaction_receiver : mpsc:: Receiver < TransactionBatch > ,
120
123
cancel : CancellationToken ,
121
124
) -> Result < TransactionStatsAndReceiver , ConnectionWorkersSchedulerError > {
122
- let endpoint = Self :: setup_endpoint ( bind, identity . as_ref ( ) ) ?;
125
+ let endpoint = Self :: setup_endpoint ( bind, stake_identity . as_ref ( ) ) ?;
123
126
debug ! ( "Client endpoint bind address: {:?}" , endpoint. local_addr( ) ) ;
124
127
let mut workers = WorkersCache :: new ( num_connections, cancel. clone ( ) ) ;
125
128
let mut send_stats_per_addr = SendTransactionStatsPerAddr :: new ( ) ;
@@ -195,9 +198,9 @@ impl ConnectionWorkersScheduler {
195
198
/// Sets up the QUIC endpoint for the scheduler to handle connections.
196
199
fn setup_endpoint (
197
200
bind : SocketAddr ,
198
- identity : Option < & Keypair > ,
201
+ stake_identity : Option < & Keypair > ,
199
202
) -> Result < Endpoint , ConnectionWorkersSchedulerError > {
200
- let client_certificate = QuicClientCertificate :: new ( identity ) ;
203
+ let client_certificate = QuicClientCertificate :: new ( stake_identity ) ;
201
204
let client_config = create_client_config ( client_certificate) ;
202
205
let endpoint = create_client_endpoint ( bind, client_config) ?;
203
206
Ok ( endpoint)
0 commit comments