Skip to content

Commit f14ef56

Browse files
committed
fix(governance/xc_admin): init publishers for price store only when needed
1 parent 95ed716 commit f14ef56

File tree

1 file changed

+11
-6
lines changed
  • governance/xc_admin/packages/xc_admin_frontend/components/tabs

1 file changed

+11
-6
lines changed

governance/xc_admin/packages/xc_admin_frontend/components/tabs/General.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
290290
const handleSendProposalButtonClick = async () => {
291291
if (pythProgramClient && dataChanges && !isMultisigLoading && squads) {
292292
const instructions: TransactionInstruction[] = []
293-
const publisherInitializationsVerified: PublicKey[] = []
293+
const publisherInPriceStoreInitializationsVerified: PublicKey[] = []
294294

295295
for (const symbol of Object.keys(dataChanges)) {
296296
const multisigAuthority = squads.getAuthorityPDA(
@@ -301,9 +301,14 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
301301
? mapKey(multisigAuthority)
302302
: multisigAuthority
303303

304-
const initPublisher = async (publisherKey: PublicKey) => {
304+
const initPublisherInPriceStore = async (publisherKey: PublicKey) => {
305+
// Price store is only available in Pythnet and Pythtest-crosschain
306+
if (cluster !== 'pythnet' && cluster !== 'pythtest-crosschain') {
307+
return
308+
}
309+
305310
if (
306-
publisherInitializationsVerified.every(
311+
publisherInPriceStoreInitializationsVerified.every(
307312
(el) => !el.equals(publisherKey)
308313
)
309314
) {
@@ -321,7 +326,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
321326
)
322327
)
323328
}
324-
publisherInitializationsVerified.push(publisherKey)
329+
publisherInPriceStoreInitializationsVerified.push(publisherKey)
325330
}
326331
}
327332
const { prev, new: newChanges } = dataChanges[symbol]
@@ -406,7 +411,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
406411
})
407412
.instruction()
408413
)
409-
await initPublisher(publisherPubKey)
414+
await initPublisherInPriceStore(publisherPubKey)
410415
}
411416

412417
// create set min publisher instruction if there are any publishers
@@ -576,7 +581,7 @@ const General = ({ proposerServerUrl }: { proposerServerUrl: string }) => {
576581
})
577582
.instruction()
578583
)
579-
await initPublisher(publisherPubKey)
584+
await initPublisherInPriceStore(publisherPubKey)
580585
}
581586
}
582587
}

0 commit comments

Comments
 (0)