2

When creating a pathpayment, the ideal use case would be to not have to provide a path, but rather rely on the stellar path finding algorithm to resolve the best (i.e. cheapest) path and then execute the operation.

I tested this and omitted the path, and received errors such as "op_too_few_offers" which means exactly what you'd think, however, when calling the pathfinding, I clearly see that there are paths.

Is the issue in the behavior during omission of a path or the lack of a required check for a path?

2 Answers 2

2

If you don't set path param then the path payment behavior is convert sendAsset to destAsset with default order book (between two assets).

Unfortunately you have to "search" for path first and then "build the path" for path payment.

Please notice that find payment paths still needs some work. I did multiple tests and finally I had to build a custom solution.

Regards Juan

2
  • 1
    Nice. Is your solution open source?
    – Synesso
    Commented Jul 30, 2018 at 0:36
  • The path finding algorithm used in Horizon as-is, is just an example, and is supposed to be replaced by the operator. Commented Aug 30, 2018 at 4:12
1

When you don't set any path you still have a sendAsset and a destAsset, so the expected behavior is a conversion from one to another under the defined thresholds (destAmount and sendMax).

You get this error because of course you there's not enough offer for the conversion to happen fully.

In most cases you would want to omit the path attribute when one of sendAsset/destAsset is lumens. When it is not the case, you would use path=XLM.

I think the Stellar team mentioned they were developing an algorithm to find the best pathes. I don't think this computation will end up being done by validators node because it's already have a lot to handle. I could be wrong on that, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.