@@ -755,10 +755,16 @@ fn beefy_importing_blocks() {
755
755
block_on( block_import. import_block( params( block, None ) , HashMap :: new( ) ) ) . unwrap( ) ,
756
756
ImportResult :: AlreadyInChain
757
757
) ;
758
- // Verify no justifications present:
758
+ // Verify no BEEFY justifications present:
759
759
{
760
760
// none in backend,
761
- assert ! ( full_client. justifications( & block_id) . unwrap( ) . is_none( ) ) ;
761
+ assert_eq ! (
762
+ full_client
763
+ . justifications( & block_id)
764
+ . unwrap( )
765
+ . and_then( |j| j. get( BEEFY_ENGINE_ID ) . cloned( ) ) ,
766
+ None
767
+ ) ;
762
768
// and none sent to BEEFY worker.
763
769
block_on ( poll_fn ( move |cx| {
764
770
assert_eq ! ( justif_recv. poll_next_unpin( cx) , Poll :: Pending ) ;
@@ -787,11 +793,18 @@ fn beefy_importing_blocks() {
787
793
..Default :: default ( )
788
794
} ) ,
789
795
) ;
790
- // Verify justification successfully imported:
796
+ // Verify BEEFY justification successfully imported:
791
797
{
792
- // available in backend,
793
- assert ! ( full_client. justifications( & BlockId :: Number ( block_num) ) . unwrap( ) . is_some( ) ) ;
794
- // and also sent to BEEFY worker.
798
+ // still not in backend (worker is responsible for appending to backend),
799
+ assert_eq ! (
800
+ full_client
801
+ . justifications( & block_id)
802
+ . unwrap( )
803
+ . and_then( |j| j. get( BEEFY_ENGINE_ID ) . cloned( ) ) ,
804
+ None
805
+ ) ;
806
+ // but sent to BEEFY worker
807
+ // (worker will append it to backend when all previous mandatory justifs are there as well).
795
808
block_on ( poll_fn ( move |cx| {
796
809
match justif_recv. poll_next_unpin ( cx) {
797
810
Poll :: Ready ( Some ( _justification) ) => ( ) ,
@@ -823,10 +836,16 @@ fn beefy_importing_blocks() {
823
836
..Default :: default ( )
824
837
} ) ,
825
838
) ;
826
- // Verify bad justifications was not imported:
839
+ // Verify bad BEEFY justifications was not imported:
827
840
{
828
841
// none in backend,
829
- assert ! ( full_client. justifications( & block_id) . unwrap( ) . is_none( ) ) ;
842
+ assert_eq ! (
843
+ full_client
844
+ . justifications( & BlockId :: Number ( block_num) )
845
+ . unwrap( )
846
+ . and_then( |j| j. get( BEEFY_ENGINE_ID ) . cloned( ) ) ,
847
+ None
848
+ ) ;
830
849
// and none sent to BEEFY worker.
831
850
block_on ( poll_fn ( move |cx| {
832
851
assert_eq ! ( justif_recv. poll_next_unpin( cx) , Poll :: Pending ) ;
0 commit comments