@@ -26,7 +26,7 @@ use timeboost_types::{CandidateList, CandidateListBytes, InclusionList};
26
26
use tokio:: select;
27
27
use tokio:: sync:: mpsc:: { self , Receiver , Sender } ;
28
28
use tokio:: task:: { JoinHandle , spawn} ;
29
- use tracing:: { error, info, warn} ;
29
+ use tracing:: { debug , error, info, warn} ;
30
30
31
31
use decrypt:: { Decrypter , DecrypterError } ;
32
32
use include:: Includer ;
@@ -78,6 +78,7 @@ struct Task {
78
78
commands : Receiver < Command > ,
79
79
output : Sender < Output > ,
80
80
mode : Mode ,
81
+ round : Option < RoundNumber > ,
81
82
}
82
83
83
84
enum Command {
@@ -188,6 +189,7 @@ impl Sequencer {
188
189
output : tx,
189
190
commands : cr,
190
191
mode : Mode :: Passive ,
192
+ round : None ,
191
193
} ;
192
194
193
195
Ok ( Self {
@@ -374,9 +376,23 @@ impl Task {
374
376
if let Action :: Deliver ( payload) = action {
375
377
match payload. data ( ) . decode :: < MAX_MESSAGE_SIZE > ( ) {
376
378
Ok ( data) => {
377
- round = payload. round ( ) . num ( ) ;
378
- evidence = payload. into_evidence ( ) ;
379
- lists. push ( data)
379
+ if self
380
+ . round
381
+ . map ( |r| r < payload. round ( ) . num ( ) )
382
+ . unwrap_or ( true )
383
+ {
384
+ round = payload. round ( ) . num ( ) ;
385
+ evidence = payload. into_evidence ( ) ;
386
+ lists. push ( data)
387
+ } else {
388
+ debug ! (
389
+ node = %self . label,
390
+ ours = ?self . round. map( u64 :: from) ,
391
+ theirs = %payload. round( ) . num( ) ,
392
+ src = %payload. source( ) ,
393
+ "dropping delayed payload"
394
+ ) ;
395
+ }
380
396
}
381
397
Err ( err) => {
382
398
warn ! (
@@ -393,6 +409,8 @@ impl Task {
393
409
}
394
410
}
395
411
if !lists. is_empty ( ) {
412
+ debug_assert ! ( self . round < Some ( round) ) ;
413
+ self . round = Some ( round) ;
396
414
candidates. push ( ( round, evidence, lists) )
397
415
}
398
416
while let Some ( action) = actions. pop_front ( ) {
0 commit comments