@@ -300,7 +300,7 @@ where
300
300
) -> Result < PreprocessOutcome < SP :: Verifier > , LocalError > {
301
301
// Quick preliminary checks, before we proceed with more expensive verification
302
302
let key = self . verifier ( ) ;
303
- if self . transcript . is_banned ( from ) || accum. is_banned ( from) {
303
+ if accum. is_banned ( from) {
304
304
trace ! ( "{key:?} Banned." ) ;
305
305
return Ok ( PreprocessOutcome :: remote_error ( "The sender is banned" ) ) ;
306
306
}
@@ -417,7 +417,10 @@ where
417
417
418
418
/// Makes an accumulator for a new round.
419
419
pub fn make_accumulator ( & self ) -> RoundAccumulator < P , SP > {
420
- RoundAccumulator :: new ( & self . communication_info . expecting_messages_from )
420
+ RoundAccumulator :: new (
421
+ & self . communication_info . expecting_messages_from ,
422
+ self . transcript . banned_ids ( ) ,
423
+ )
421
424
}
422
425
423
426
fn terminate_inner (
@@ -549,6 +552,7 @@ pub enum CanFinalize {
549
552
/// A mutable accumulator for collecting the results and errors from processing messages for a single round.
550
553
#[ derive_where:: derive_where( Debug ) ]
551
554
pub struct RoundAccumulator < P : Protocol < SP :: Verifier > , SP : SessionParameters > {
555
+ banned_ids : BTreeSet < SP :: Verifier > ,
552
556
still_have_not_sent_messages : BTreeSet < SP :: Verifier > ,
553
557
expecting_messages_from : IdSet < SP :: Verifier > ,
554
558
processing : BTreeSet < SP :: Verifier > ,
@@ -567,8 +571,9 @@ where
567
571
P : Protocol < SP :: Verifier > ,
568
572
SP : SessionParameters ,
569
573
{
570
- fn new ( expecting_messages_from : & IdSet < SP :: Verifier > ) -> Self {
574
+ fn new ( expecting_messages_from : & IdSet < SP :: Verifier > , banned_ids : BTreeSet < SP :: Verifier > ) -> Self {
571
575
Self {
576
+ banned_ids,
572
577
still_have_not_sent_messages : expecting_messages_from. all ( ) . clone ( ) ,
573
578
expecting_messages_from : expecting_messages_from. clone ( ) ,
574
579
processing : BTreeSet :: new ( ) ,
@@ -589,15 +594,15 @@ where
589
594
. is_quorum ( & self . payloads . keys ( ) . cloned ( ) . collect :: < BTreeSet < _ > > ( ) )
590
595
{
591
596
CanFinalize :: Yes
592
- } else if ! self . still_have_not_sent_messages . is_empty ( ) {
597
+ } else if self . expecting_messages_from . is_quorum_possible ( & self . banned_ids ) {
593
598
CanFinalize :: NotYet
594
599
} else {
595
600
CanFinalize :: Never
596
601
}
597
602
}
598
603
599
604
fn is_banned ( & self , from : & SP :: Verifier ) -> bool {
600
- self . provable_errors . contains_key ( from ) || self . unprovable_errors . contains_key ( from)
605
+ self . banned_ids . contains ( from)
601
606
}
602
607
603
608
fn message_is_being_processed ( & self , from : & SP :: Verifier ) -> bool {
@@ -619,6 +624,7 @@ where
619
624
from
620
625
) ) )
621
626
} else {
627
+ self . banned_ids . insert ( from. clone ( ) ) ;
622
628
Ok ( ( ) )
623
629
}
624
630
}
@@ -630,6 +636,7 @@ where
630
636
from
631
637
) ) )
632
638
} else {
639
+ self . banned_ids . insert ( from. clone ( ) ) ;
633
640
Ok ( ( ) )
634
641
}
635
642
}
@@ -728,10 +735,7 @@ where
728
735
) ?;
729
736
self . register_provable_error ( & from, evidence)
730
737
}
731
- ReceiveErrorType :: Unprovable ( error) => {
732
- self . unprovable_errors . insert ( from. clone ( ) , error) ;
733
- Ok ( ( ) )
734
- }
738
+ ReceiveErrorType :: Unprovable ( error) => self . register_unprovable_error ( & from, error) ,
735
739
ReceiveErrorType :: Echo ( error) => {
736
740
let ( _echo_broadcast, normal_broadcast, _direct_message) = processed. message . into_parts ( ) ;
737
741
let evidence = Evidence :: new_echo_round_error ( & from, normal_broadcast, * error) ?;
0 commit comments