@@ -104,7 +104,7 @@ pub struct Downstream {
104104 pub ( super ) difficulty_mgmt : DownstreamDifficultyConfig ,
105105 pub ( super ) upstream_difficulty_config : Arc < Mutex < UpstreamDifficultyConfig > > ,
106106 pub last_call_to_update_hr : u128 ,
107- pub ( super ) last_notify : Option < server_to_client:: Notify < ' static > > ,
107+ pub ( super ) recent_notifies : VecDeque < server_to_client:: Notify < ' static > > ,
108108 pub ( super ) stats_sender : StatsSender ,
109109}
110110
@@ -167,6 +167,11 @@ impl Downstream {
167167 initial_difficulty,
168168 } ;
169169
170+ let mut recent_notifies = VecDeque :: with_capacity ( 2 ) ;
171+ if let Some ( notify) = last_notify. clone ( ) {
172+ recent_notifies. push_back ( notify) ;
173+ }
174+
170175 let downstream = Arc :: new ( Mutex :: new ( Downstream {
171176 connection_id,
172177 authorized_names : vec ! [ ] ,
@@ -180,7 +185,7 @@ impl Downstream {
180185 difficulty_mgmt,
181186 upstream_difficulty_config,
182187 last_call_to_update_hr : 0 ,
183- last_notify : last_notify . clone ( ) ,
188+ recent_notifies : recent_notifies . clone ( ) ,
184189 stats_sender,
185190 } ) ) ;
186191
@@ -213,7 +218,7 @@ impl Downstream {
213218 task_manager. clone ( ) ,
214219 downstream. clone ( ) ,
215220 rx_sv1_notify,
216- last_notify ,
221+ recent_notifies ,
217222 host. clone ( ) ,
218223 connection_id,
219224 )
@@ -354,7 +359,7 @@ impl Downstream {
354359 difficulty_mgmt,
355360 upstream_difficulty_config,
356361 last_call_to_update_hr : 0 ,
357- last_notify : None ,
362+ recent_notifies : VecDeque :: with_capacity ( 2 ) ,
358363 stats_sender,
359364 }
360365 }
@@ -417,7 +422,10 @@ impl IsServer<'static> for Downstream {
417422 /// When miner find the job which meets requested difficulty, it can submit share to the server.
418423 /// Only [Submit](client_to_server::Submit) requests for authorized user names can be submitted.
419424 fn handle_submit ( & self , request : & client_to_server:: Submit < ' static > ) -> bool {
420- info ! ( "Down: Handling mining.submit: {:?}" , & request) ;
425+ info ! (
426+ "Downstream {}: Handling mining.submit for job_id {}" ,
427+ self . connection_id, request. job_id
428+ ) ;
421429
422430 // check first job received
423431 if !self . first_job_received {
@@ -427,7 +435,7 @@ impl IsServer<'static> for Downstream {
427435 //check allowed to send shares
428436 match allow_submit_share ( ) {
429437 Ok ( true ) => {
430- let Some ( job ) = & self . last_notify else {
438+ if self . recent_notifies . is_empty ( ) {
431439 error ! ( "Share rejected: No last job found" ) ;
432440 self . stats_sender . update_rejected_shares ( self . connection_id ) ;
433441 return false ;
@@ -436,7 +444,7 @@ impl IsServer<'static> for Downstream {
436444 //check share is valid
437445 if validate_share (
438446 request,
439- job ,
447+ & self . recent_notifies ,
440448 self . difficulty_mgmt . current_difficulty ,
441449 self . extranonce1 . clone ( ) ,
442450 self . version_rolling_mask . clone ( ) ,
0 commit comments