Add RPC client PollTransaction with exponential backoff - #5876
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a PollTransaction method to the RPC client that provides a convenient way for callers to wait for transaction finalization. The method polls GetTransaction until the transaction reaches a terminal state (SUCCESS or FAILED) using exponential backoff, respecting context cancellation for timeout control. This eliminates the need for callers to implement their own polling logic.
Key changes:
- New
PollTransactionmethod with exponential backoff strategy - Configurable
PollTransactionOptionsfor customizing polling intervals - Comprehensive test suite covering success, failure, polling, timeout, and error scenarios
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| clients/rpcclient/main.go | Adds PollTransaction method, PollTransactionOptions struct with builder methods, and backoff configuration logic |
| clients/rpcclient/main_test.go | Adds comprehensive test coverage including success/failure cases, polling behavior, context timeout, and RPC error handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Shaptic
reviewed
Jan 6, 2026
leighmcculloch
enabled auto-merge (squash)
January 6, 2026 21:53
leighmcculloch
added a commit
to stellar/friendbot
that referenced
this pull request
Jan 9, 2026
### What Replace custom backoff-based transaction polling logic with the Go Stellar SDK's built-in PollTransaction method. ### Why The go-stellar-sdk is getting PollTransaction functionality in stellar/go-stellar-sdk#5876, which is a port over of the polling transaction logic in friendbot. Now that the logic has been incorporated into the SDK, that eliminates the need for that logic to live and be maintained here. Dependent on: - #37 - stellar/go-stellar-sdk#5876
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add PollTransaction method to RPC client that polls GetTransaction until a terminal state (SUCCESS or FAILED) is reached. Use exponential backoff between attempts with configurable initial and max intervals. Respect context cancellation for timeout control.
Why
Callers need a convenient way to wait for transaction finalization without implementing their own polling logic and backoff strategy. We were adding this function to Friendbot, and @Shaptic pointed out that we could include this in the RPC client.
Close #5875