Sfoglia il codice sorgente

p2w-client: Fix a state update bug for state updates

commit-id:29f44a39
Stan Drozd 3 anni fa
parent
commit
1388dc1300
1 ha cambiato i file con 11 aggiunte e 3 eliminazioni
  1. 11 3
      solana/pyth2wormhole/client/src/batch_state.rs

+ 11 - 3
solana/pyth2wormhole/client/src/batch_state.rs

@@ -150,10 +150,18 @@ impl<'a> BatchState<'a> {
                     }
                 }
             }
+        }
 
-            // Update with newer state if a condition was met (including this iteration, hence not in an else)
-            if ret.is_some() {
-                *old_new_tup.0 = *old_new_tup.1;
+        // Update with newer state if a condition was met
+        if ret.is_some() {
+            for (old, new) in self
+                .last_known_symbol_states
+                .iter_mut()
+                .zip(new_symbol_states.into_iter())
+            {
+                if new.is_some() {
+                    *old = new;
+                }
             }
         }