Skip to content

Commit a0db426

Browse files
authored
Fix relaying (#658)
1 parent 4524bd4 commit a0db426

File tree

1 file changed

+11
-3
lines changed
  • governance/xc_admin/packages/crank_pythnet_relayer/src

1 file changed

+11
-3
lines changed

governance/xc_admin/packages/crank_pythnet_relayer/src/index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async function run() {
6666
: -1;
6767
lastSequenceNumber = Math.max(lastSequenceNumber, OFFSET);
6868
const wormholeApi = WORMHOLE_API_ENDPOINT[CLUSTER];
69-
69+
const productAccountToSymbol: { [key: string]: string } = {};
7070
while (true) {
7171
lastSequenceNumber += 1;
7272
console.log(`Trying sequence number : ${lastSequenceNumber}`);
@@ -129,20 +129,28 @@ async function run() {
129129
AccountType.Product
130130
)
131131
);
132+
productAccountToSymbol[
133+
parsedInstruction.accounts.named.productAccount.pubkey.toBase58()
134+
] = parsedInstruction.args.symbol;
132135
} else if (
133136
parsedInstruction instanceof PythMultisigInstruction &&
134137
parsedInstruction.name == "addPrice"
135138
) {
136139
const productAccount = await provider.connection.getAccountInfo(
137140
parsedInstruction.accounts.named.productAccount.pubkey
138141
);
139-
if (productAccount) {
142+
const productSymbol = productAccount
143+
? parseProductData(productAccount.data).product.symbol
144+
: productAccountToSymbol[
145+
parsedInstruction.accounts.named.productAccount.pubkey.toBase58()
146+
];
147+
if (productSymbol) {
140148
preInstructions.push(
141149
await getCreateAccountWithSeedInstruction(
142150
provider.connection,
143151
CLUSTER,
144152
provider.wallet.publicKey,
145-
parseProductData(productAccount.data).product.symbol,
153+
productSymbol,
146154
AccountType.Price
147155
)
148156
);

0 commit comments

Comments
 (0)