File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
sdk-libs/program-test/src/indexer Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -555,14 +555,12 @@ impl Indexer for TestIndexer {
555
555
}
556
556
}
557
557
558
- // reverse so that we can pop elements.
559
- proof_inputs. reverse ( ) ;
560
- // Reinsert.
561
- for index in indices_to_remove. iter ( ) . rev ( ) {
562
- if root_indices. len ( ) <= * index {
563
- root_indices. push ( proof_inputs. pop ( ) . unwrap ( ) ) ;
558
+ // Reinsert proof_inputs at their original positions in forward order
559
+ for ( proof_input, & index) in proof_inputs. iter ( ) . zip ( indices_to_remove. iter ( ) ) {
560
+ if root_indices. len ( ) <= index {
561
+ root_indices. push ( proof_input. clone ( ) ) ;
564
562
} else {
565
- root_indices. insert ( * index, proof_inputs . pop ( ) . unwrap ( ) ) ;
563
+ root_indices. insert ( index, proof_input . clone ( ) ) ;
566
564
}
567
565
}
568
566
root_indices
You can’t perform that action at this time.
0 commit comments