Don't read a settled swap amount out of a failed transaction - #3003
Merged
Conversation
…saction getSettledPathPaymentStrictSendAmount accepted both txSuccess and txFailed before selecting the operation result. A txFailed result still carries per-operation results, and an operation that succeeded before a later one failed reports its own pathPaymentStrictSendSuccess there — but Stellar transactions are atomic, so that path payment was rolled back and nothing settled. The helper would return the rolled-back amount, contradicting the clean-success contract its own docstring states and reporting to_amount / to_amount_usd for a swap that never happened. Require txSuccess. The fee-bump descent is unchanged: an inner result that is not txSuccess now returns null through the same check. The added test builds a txFailed result whose first operation is a settled path payment and whose second failed; it returns "5" against the previous code and null with the fix. The existing txFailed case only covered the path payment itself failing, so this gap was untested. Found by Copilot on the mobile port of this telemetry (stellar/freighter-mobile#996), which carries the identical helper and the same fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TVe5MM4mHCXUTevzdvHhq4
Contributor
There was a problem hiding this comment.
Pull request overview
Ensures failed atomic transactions cannot report rolled-back swap amounts as settled telemetry.
Changes:
- Requires a successful transaction result before reading operation amounts.
- Adds regression coverage for an earlier successful operation followed by failure.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
extension/src/helpers/transactionResult.ts |
Rejects all non-success transaction results. |
extension/src/helpers/transactionResult.test.ts |
Tests the atomic rollback scenario. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
|
PR Preview build is ready: https://github.com/stellar/freighter/releases/tag/untagged-70585ed3f7616afdaf48 |
aristidesstaffieri
approved these changes
Sep 9, 2026
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.
Fixes a bug that returned swap amounts for use in telemetry if the operation was successful but the transaction wasn't.