I think I understand, for the most part, how rippled finds transaction paths, and how gateways can charge transit fees; but some of the edge cases have me wondering...
Let's say my wallet has XYZ from xyzGateway, and I've offered to sell 1000 XYZ for 100 USD from usdGateway. For simplicity, let's say that's the only offer on the books trading XYZ for USD.
Next, my friend Alice has over 100 USD:usdGateway in her wallet. And to settle a debt between us, she sends me 1000 XYZ.
There's a path that might work. The first leg of the path is 100 USD:usdGateway from Alice to me. The next leg is my own offer to trade 1000 XYZ:xyzGateway for 100 USD:usdGateway. I would make that trade with myself, so that afterwards my wallet contains 1000 XYZ and 100 USD.
Will ripple find the path described above? Let's call it path #1.
There's another path that might work. The first leg is Alice takes my offer, I get her USD and she gets my XYZ. The next leg of the path sends the XYZ back to my wallet.
Will ripple find this path #2? Specifically, will it be found even if Alice does not trust XYZ:xyzGateway? Does Alice's action of sending XYZ to me imply her trust of that currency?
I believe the two paths are equal in their net effect: 100 USD subtracted from Alice's wallet, and 100 USD added to my wallet. And I still have 1000 XYZ in my wallet. And my offer to sell XYZ for USD is removed from the ledger.
However, transit fees could make those two paths not equivalent. Let's say that usdGateway charges 1% in transit fees. And likewise xyzGatway charges 1%. Path #1 described above would incure 1% fee when Alice sends USD to me (she'd have to send 101 instead of 100). It's unclear to me, would the trade leg (trade with myself) would incur still more transit fees from either gateway?
And regarding path #2, there would be a 1% fee to usdGateway when Alice trades for XYZ, and a 1% fee from me to xyzGateway, and finally one more 1% fee for the leg sending XYZ from Alice to me? Am I correct that this path pays single transit fees to usdGatway and double fees to xyzGateway.
Thanks in advance for help with this. Apologies for cramming multiple questions into one post. I several questions just to understand what Ripple would do when Alice attempts to send the XYZ.