File tree Expand file tree Collapse file tree 3 files changed +15
-19
lines changed
mithril-common/src/test/builder
mithril-test-lab/mithril-end-to-end/src/utils Expand file tree Collapse file tree 3 files changed +15
-19
lines changed Original file line number Diff line number Diff line change @@ -128,8 +128,8 @@ impl Party {
128128 println ! (
129129 "Party #{}: {}" ,
130130 self . party_id,
131- if signature . is_some ( ) {
132- format!( "lottery #{:?} won" , signature . as_ref ( ) . unwrap ( ) . indexes)
131+ if let Some ( sig ) = & signature {
132+ format!( "lottery #{:?} won" , sig . indexes)
133133 } else {
134134 "lost all lotteries" . to_string( )
135135 }
Original file line number Diff line number Diff line change @@ -565,21 +565,17 @@ impl<'a> CertificateChainBuilder<'a> {
565565 . map ( |c| c. epoch != certificate. epoch )
566566 . unwrap_or ( true ) ;
567567
568- certificates_chained
569- . iter ( )
570- . rev ( )
571- . filter ( |c| {
572- if is_certificate_first_of_epoch {
573- // The previous certificate of the first certificate of an epoch
574- // is the first certificate of the previous epoch
575- c. epoch == certificate. epoch . previous ( ) . unwrap ( )
576- } else {
577- // The previous certificate of not the first certificate of an epoch
578- // is the first certificate of the epoch
579- c. epoch == certificate. epoch
580- }
581- } )
582- . next_back ( )
568+ certificates_chained. iter ( ) . rev ( ) . rfind ( |c| {
569+ if is_certificate_first_of_epoch {
570+ // The previous certificate of the first certificate of an epoch
571+ // is the first certificate of the previous epoch
572+ c. epoch == certificate. epoch . previous ( ) . unwrap ( )
573+ } else {
574+ // The previous certificate of not the first certificate of an epoch
575+ // is the first certificate of the epoch
576+ c. epoch == certificate. epoch
577+ }
578+ } )
583579 }
584580 CertificateChainingMethod :: Sequential => certificates_chained. last ( ) ,
585581 }
Original file line number Diff line number Diff line change @@ -30,11 +30,11 @@ macro_rules! attempt {
3030
3131#[ cfg( test) ]
3232mod tests {
33- use crate :: attempt;
34- use crate :: utils:: AttemptResult ;
3533 use std:: time:: Duration ;
3634 use tokio:: time:: Instant ;
3735
36+ use crate :: utils:: AttemptResult ;
37+
3838 const EMPTY_RESULT : Result < Option < ( ) > , String > = Ok ( None ) ;
3939
4040 #[ tokio:: test]
You can’t perform that action at this time.
0 commit comments