Skip to content

Commit cd1b74e

Browse files
committed
Fix race condiction of buffer account not being finalized yet
1 parent 33598d2 commit cd1b74e

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

dist/index.js

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/squad-upgrade.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ async function createMetadataInstructions(
256256
address: authorityAddr
257257
} as TransactionSigner
258258

259-
const metadataAccount = await getAccountInfoWithRetry(
260-
connection,
261-
metadataPdaPubkey
259+
const metadataAccount = await connection.getAccountInfo(
260+
metadataPdaPubkey,
261+
'confirmed'
262262
)
263263

264264
if (metadataAccount) {
@@ -284,10 +284,14 @@ async function createMetadataInstructions(
284284
// Transfer -> Allocate -> Extend (if needed) -> Write -> Initialize
285285
console.log('Metadata account does not exist, adding init instructions')
286286

287-
const bufferAccount = await getAccountInfoWithRetry(connection, bufferAddress)
287+
const bufferAccount = await connection.getAccountInfo(
288+
bufferAddress,
289+
'confirmed'
290+
)
288291
if (!bufferAccount) {
289292
throw new Error(
290-
`Could not fetch metadata buffer account ${bufferAddress.toString()}`
293+
`Metadata buffer account ${bufferAddress.toString()} not found. ` +
294+
'Make sure the buffer was created and is on the correct cluster.'
291295
)
292296
}
293297

0 commit comments

Comments
 (0)