Fix bugs in pathfinding with XRP as the source currency

Cherry-picked from sp3