Skip to content
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

rpc-client: Improve transaction confirmation logic for load-balanced endpoints #3787

Open
joncinque opened this issue Nov 25, 2024 · 0 comments

Comments

@joncinque
Copy link

Problem

The Rust RPC client assumes that the endpoint it's using isn't load-balanced, which can cause for false errors on transaction confirmations. For example, the confirmation logic in send_and_confirm_transaction is just checking that the given blockhash is valid for processed commitment:

match self.get_signature_status(&signature).await? {
Some(Ok(_)) => return Ok(signature),
Some(Err(e)) => return Err(e.into()),
None => {
if !self
.is_blockhash_valid(&recent_blockhash, CommitmentConfig::processed())
.await?
{
// Block hash is not found by some reason
break 'sending;
} else if cfg!(not(test))
// Ignore sleep at last step.
&& status_retry < GET_STATUS_RETRIES
{
// Retry twice a second
sleep(Duration::from_millis(500)).await;
continue;
}
}
}

If that call hits an RPC node that's further behind, the confirmation may incorrectly return an error.

Proposed Solution

We already have the technology for this!

Make use of these and make the Rust RPC client a bit smarter, like the JS client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant