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

exp/orderbook: Include empty paths in path finding response #4137

Merged
merged 2 commits into from
Dec 10, 2021

Conversation

tamirms
Copy link
Contributor

@tamirms tamirms commented Dec 9, 2021

PR Checklist

PR Structure

  • This PR has reasonably narrow scope (if not, break it down into smaller PRs).
  • This PR avoids mixing refactoring changes with feature changes (split into two PRs
    otherwise).
  • This PR's title starts with name of package that is most changed in the PR, ex.
    services/friendbot, or all or doc if the changes are broad or impact many
    packages.

Thoroughness

  • This PR adds tests for the most critical parts of the new functionality or fixes.
  • I've updated any docs (developer docs, .md
    files, etc... affected by this change). Take a look in the docs folder for a given service,
    like this one.

Release planning

  • I've updated the relevant CHANGELOG (here for Horizon) if
    needed with deprecations, added features, breaking changes, and DB schema changes.
  • I've decided if this PR requires a new major/minor version according to
    semver, or if it's mainly a patch change. The PR is targeted at the next
    release branch if it's not a patch change.

What

Fixes #4131

If the source asset is included in the list of destination assets we will include the empty path in the path finding response. For example:

If we receive the following /paths/strict-send query:

destination_assets=native,BTC:GAUTUYY2THLF7SGITDFMXJVYH3LHDSMGEAKSBU267M2K7A3W543CKUEF

source_asset=BTC:GAUTUYY2THLF7SGITDFMXJVYH3LHDSMGEAKSBU267M2K7A3W543CKUEF

source_amount=0.0005953

We will include the following empty path in the response:

{
        "source_asset_type": "credit_alphanum4",
        "source_asset_code": "BTC",
        "source_asset_issuer": "GAUTUYY2THLF7SGITDFMXJVYH3LHDSMGEAKSBU267M2K7A3W543CKUEF",
        "source_amount": "0.0005953",
        "destination_asset_type": "credit_alphanum4",
        "destination_asset_code": "BTC",
        "destination_asset_issuer": "GAUTUYY2THLF7SGITDFMXJVYH3LHDSMGEAKSBU267M2K7A3W543CKUEF",
        "destination_amount": "0.0005953",
        "path": []
      }

Why

Simple payments (e.g. payments where an asset is transferred from one account to another without any conversions into another asset) are also valid path payments. Because the path finding endpoint is used to construct path payments we should not omit paths corresponding to simple payments.

Known limitations

[N/A]

@tamirms tamirms requested a review from a team December 9, 2021 07:28
Copy link
Contributor

@Shaptic Shaptic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tamirms tamirms merged commit e80796c into stellar:master Dec 10, 2021
@tamirms tamirms deleted the empty-paths branch December 10, 2021 14:11
@marcinx
Copy link
Contributor

marcinx commented Dec 10, 2021

Will this also work when a destination_account is given (instead of the list of destination assets) and vice versa with a given source_account (instead of source_assets)?

@tamirms
Copy link
Contributor Author

tamirms commented Dec 10, 2021

@marcinx yes, it should work. the destination account is converted into a list of assets before reaching this code.

Copy link

@eliane345 eliane345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Desculpe o transtorno

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

Successfully merging this pull request may close these issues.

Regression in 2.12. Pathfinding
4 participants