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 @@ -554,14 +554,12 @@ impl Indexer for TestIndexer {
554
554
}
555
555
}
556
556
557
- // reverse so that we can pop elements.
558
- proof_inputs. reverse ( ) ;
559
- // Reinsert.
560
- for index in indices_to_remove. iter ( ) . rev ( ) {
561
- if root_indices. len ( ) <= * index {
562
- root_indices. push ( proof_inputs. pop ( ) . unwrap ( ) ) ;
557
+ // Reinsert proof_inputs at their original positions in forward order
558
+ for ( proof_input, & index) in proof_inputs. iter ( ) . zip ( indices_to_remove. iter ( ) ) {
559
+ if root_indices. len ( ) <= index {
560
+ root_indices. push ( proof_input. clone ( ) ) ;
563
561
} else {
564
- root_indices. insert ( * index, proof_inputs . pop ( ) . unwrap ( ) ) ;
562
+ root_indices. insert ( index, proof_input . clone ( ) ) ;
565
563
}
566
564
}
567
565
root_indices
You can’t perform that action at this time.
0 commit comments