Explorar el Código

fix(price-pusher): randomize price feed ids (#1761)

* fix: randomize price feed ids

* Actual good sorting

* add space
guibescos hace 1 año
padre
commit
f5af4125eb
Se han modificado 2 ficheros con 9 adiciones y 2 borrados
  1. 1 1
      apps/price_pusher/package.json
  2. 8 1
      apps/price_pusher/src/solana/solana.ts

+ 1 - 1
apps/price_pusher/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@pythnetwork/price-pusher",
-  "version": "7.0.1",
+  "version": "7.0.2",
   "description": "Pyth Price Pusher",
   "homepage": "https://pyth.network",
   "main": "lib/index.js",

+ 8 - 1
apps/price_pusher/src/solana/solana.ts

@@ -93,10 +93,17 @@ export class SolanaPricePusher implements IPricePusher {
       return;
     }
 
+    const shuffledPriceIds = priceIds
+      .map((x) => {
+        return { element: x, key: Math.random() };
+      })
+      .sort((a, b) => a.key - b.key)
+      .map((x) => x.element);
+
     let priceFeedUpdateData;
     try {
       priceFeedUpdateData = await this.priceServiceConnection.getLatestVaas(
-        priceIds
+        shuffledPriceIds
       );
     } catch (err: any) {
       this.logger.error(err, "getPriceFeedsUpdateData failed:");