stellar-deprecated / horizon

This repository has moved to the go monorepo: https://github.com/stellar/go/tree/master/services/horizon
Apache License 2.0
218 stars 106 forks source link

Cannot estimate paths when account has many trustlines #409

Closed s-a-y closed 6 years ago

s-a-y commented 6 years ago

I'm trying to find paths from BTC to XLM Here's the query

I'll post example result here, because it changes over time

{
"_embedded": {
"records": [
{
"source_asset_type": "native",
"source_amount": "1000.0000000",
"destination_asset_type": "native",
"destination_amount": "1000.0000000",
"path": []
},
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "ICN",
"source_asset_issuer": "GBDEVU63Y6NTHJQQZIKVTC23NWLQVP3WJ2RI2OTSJTNYOIGICST6DUXR",
"source_amount": "11.9476800",
"destination_asset_type": "native",
"destination_amount": "1000.0000000",
"path": []
},
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "LTC",
"source_asset_issuer": "GC5LOR3BK6KIOK7GKAUD5EGHQCMFOGHJTC7I3ELB66PTDFXORC2VM5LP",
"source_amount": "0.3664700",
"destination_asset_type": "native",
"destination_amount": "1000.0000000",
"path": []
},
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "BAT",
"source_asset_issuer": "GBDEVU63Y6NTHJQQZIKVTC23NWLQVP3WJ2RI2OTSJTNYOIGICST6DUXR",
"source_amount": "103.8522300",
"destination_asset_type": "native",
"destination_amount": "1000.0000000",
"path": []
},
{
"source_asset_type": "credit_alphanum4",
"source_asset_code": "REP",
"source_asset_issuer": "GBDEVU63Y6NTHJQQZIKVTC23NWLQVP3WJ2RI2OTSJTNYOIGICST6DUXR",
"source_amount": "1.0196900",
"destination_asset_type": "native",
"destination_amount": "1000.0000000",
"path": []
}
]
}
}

Horizon limits number of returned paths to 5 and since I have many trust lines there is a good chance that BTC won't be present in the result set.

Increasing or making limit a parameter is dangerous for performance, so I assume sourceAsset optional parameter is required to be able to estimate paths between assets of my choice.

jedmccaleb commented 6 years ago

look at potential design to fix this

nikhilsaraf commented 6 years ago

After looking into this.. we are currently getting all the assets available to the source account as inputs to the pathfinder query (takes in an array of source assets). We can very easily limit this to a single source asset based on new optional url params. This will also be backwards compatible.

jedmccaleb commented 6 years ago

how expensive is it to raise the limit to say 20?

s-a-y commented 6 years ago

I imagine I'll have more than 20 tokens anyway, so either there should be a way to specify, or I'll be using some dummy accounts with few trustlines each (doesn't require anything from your side)

jedmccaleb commented 6 years ago

specifying seems weird to me since I'm not sure how the user would know what to specify? I think we need paging ultimately

s-a-y commented 6 years ago

User may not know, but wallet knows what assets user has, I don't see a problem to have that as an option. Yeah, paging is an option, but I guess having paging I'd still try to avoid it in my implementation, sending 3 consequent requests introduces big delay