Skip to content

fix: use higher commitment for blockhash to remove 'Minimum context slot has not been reached' errors #2170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
use higher commitment for blockhash
  • Loading branch information
guibescos committed Dec 5, 2024
commit 4000d06f6869809e7ad7bff83dca973911a52516
2 changes: 1 addition & 1 deletion target_chains/solana/sdk/js/solana_utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/solana-utils",
"version": "0.4.2",
"version": "0.4.3",
"description": "Utility functions for Solana",
"homepage": "https://pyth.network",
"main": "lib/index.js",
Expand Down
15 changes: 13 additions & 2 deletions target_chains/solana/sdk/js/solana_utils/src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ export async function sendTransactions(
maxRetries?: number
): Promise<string[]> {
const blockhashResult = await connection.getLatestBlockhashAndContext({
commitment: "confirmed",
commitment: "finalized",
});

const signatures: string[] = [];
Expand Down Expand Up @@ -487,7 +487,18 @@ export async function sendTransactions(
),
]);
if (confirmedTx) {
break;
console.log("this is the err", confirmedTx.err?.toString());
if (
confirmedTx.err &&
confirmedTx.err
.toString()
.includes("Minimum context slot has not been reached.")
) {
console.log("Handling minimum context slot error");
confirmedTx = null;
} else {
break;
}
}
if (maxRetries && maxRetries < retryCount) {
break;
Expand Down
Loading