File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
pallets/transaction-storage/src Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -81,15 +81,13 @@ pub fn new_test_ext() -> TestExternalities {
8181 t. into ( )
8282}
8383
84- pub fn run_to_block ( n : u64 , f : impl Fn ( ) -> Option < TransactionStorageProof > ) {
85- while System :: block_number ( ) < n {
86- if let Some ( proof) = f ( ) {
87- TransactionStorage :: check_proof ( RuntimeOrigin :: none ( ) , proof) . unwrap ( ) ;
88- }
89- TransactionStorage :: on_finalize ( System :: block_number ( ) ) ;
90- System :: on_finalize ( System :: block_number ( ) ) ;
91- System :: set_block_number ( System :: block_number ( ) + 1 ) ;
92- System :: on_initialize ( System :: block_number ( ) ) ;
93- TransactionStorage :: on_initialize ( System :: block_number ( ) ) ;
94- }
84+ pub fn run_to_block ( n : u64 , f : impl Fn ( ) -> Option < TransactionStorageProof > + ' static ) {
85+ System :: run_to_block_with :: < AllPalletsWithSystem > (
86+ n,
87+ RunToBlockHooks :: default ( ) . before_finalize ( |_| {
88+ if let Some ( proof) = f ( ) {
89+ TransactionStorage :: check_proof ( RuntimeOrigin :: none ( ) , proof) . unwrap ( ) ;
90+ }
91+ } ) ,
92+ ) ;
9593}
You can’t perform that action at this time.
0 commit comments