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

swapResultsList improvements #656

Closed
offerm opened this issue Nov 9, 2018 · 10 comments
Closed

swapResultsList improvements #656

offerm opened this issue Nov 9, 2018 · 10 comments
Assignees
Labels
enhancement New feature or request has PR issues with an open PR
Milestone

Comments

@offerm
Copy link
Contributor

offerm commented Nov 9, 2018

price is missing from the swapResultsList.

Consider also to add the preimage or remove the rhash.

Should we have role here? isn't it always zero?

xud admin$ xucli sell 0.004 LTC/BTC 0.875
{
  "internalMatchesList": [],
  "swapResultsList": [
    {
      "orderId": "d7fa8c31-e42e-11e8-8219-a328c72ea886",
      "localId": "871f9570-e42f-11e8-ba73-5559559634a7",
      "pairId": "LTC/BTC",
      "quantity": 0.0005,
      "rHash": "c3f490a0641aa4d8bd0b456e74d50650fa42182ba4e5ed162304ae1a35ade8c9",
      "amountReceived": 45000,
      "amountSent": 50000,
      "peerPubKey": "03fd337659e99e628d0487e4f87acf93e353db06f754dccc402f2de1b857a319d0",
      "role": 0
    },
    {
      "orderId": "d6a842a1-e42e-11e8-8219-a328c72ea886",
      "localId": "871f9570-e42f-11e8-ba73-5559559634a7",
      "pairId": "LTC/BTC",
      "quantity": 0.001,
      "rHash": "c95ecd85d640879ec1cca3eb447ad13d6bd1651ad2041d2682867af3fc812097",
      "amountReceived": 89000,
      "amountSent": 100000,
      "peerPubKey": "03fd337659e99e628d0487e4f87acf93e353db06f754dccc402f2de1b857a319d0",
      "role": 0
    },
    {
      "orderId": "87a31d51-e42f-11e8-8219-a328c72ea886",
      "localId": "871f9570-e42f-11e8-ba73-5559559634a7",
      "pairId": "LTC/BTC",
      "quantity": 0.001,
      "rHash": "128a1cc547a9b2d7d84cd961e50d6999e7305b3eaa5a8586c0d202a7c925c8cd",
      "amountReceived": 90000,
      "amountSent": 100000,
      "peerPubKey": "03fd337659e99e628d0487e4f87acf93e353db06f754dccc402f2de1b857a319d0",
      "role": 0
    },
    {
      "orderId": "d6a842a1-e42e-11e8-8219-a328c72ea886",
      "localId": "871f9570-e42f-11e8-ba73-5559559634a7",
      "pairId": "LTC/BTC",
      "quantity": 0.0005,
      "rHash": "269e0ffa650188925a781caa468f676a832c38b276da3ce2855cea8871ad5075",
      "amountReceived": 44500,
      "amountSent": 50000,
      "peerPubKey": "03fd337659e99e628d0487e4f87acf93e353db06f754dccc402f2de1b857a319d0",
      "role": 0
    },
    {
      "orderId": "89dd2ed1-e42f-11e8-8219-a328c72ea886",
      "localId": "871f9570-e42f-11e8-ba73-5559559634a7",
      "pairId": "LTC/BTC",
      "quantity": 0.001,
      "rHash": "136adedb482639135251cb3b3787bf61a697d72ff50f55ae142085ad75aca715",
      "amountReceived": 90000,
      "amountSent": 100000,
      "peerPubKey": "03fd337659e99e628d0487e4f87acf93e353db06f754dccc402f2de1b857a319d0",
      "role": 0
    }
  ]
}
@kilrau
Copy link
Contributor

kilrau commented Nov 10, 2018

Price is missing from the swapResultsList.

Yes, wanted to open an issue for this too!

Consider also to add the preimage or remove the rhash.

Adding preimage: yes, but why remove r_hash

Should we have role here? isn't it always zero?

Yep, I think we can remove this (always taker).

@kilrau kilrau changed the title swapResultsList - missing price swapResultsList improvements Nov 10, 2018
@kilrau kilrau added the enhancement New feature or request label Nov 10, 2018
@kilrau kilrau added this to the 1.0.0-alpha.5 milestone Nov 10, 2018
@ImmanuelSegol ImmanuelSegol self-assigned this Nov 10, 2018
@offerm
Copy link
Contributor Author

offerm commented Nov 11, 2018

@kilrau I wrote

Consider also to add the preimage or remove the rhash.

note the or. If we add the preimage, we should not remove the rhash.

@kilrau
Copy link
Contributor

kilrau commented Nov 11, 2018

Summary @ImmanuelSegol (also let us know your opinion):

  • add price
  • add preimage
  • remove role

@sangaman
Copy link
Collaborator

Adding the price makes sense, but what's the value in adding the preimage? It wouldn't hurt but I don't know how it would be useful.

The role indeed can always be determined based on whether it's a swap result from placeOrder (always taker) or from subscribeSwaps (always maker). So we can remove it but it'd be nice to add some comments explaining that clearly in the proto definition.

@offerm
Copy link
Contributor Author

offerm commented Nov 12, 2018 via email

@sangaman
Copy link
Collaborator

SubscribeSwap is working only on the maker side?

Yes this is how we agreed to approach it (otherwise it would duplicate info that we get in the placeOrder response) and is stated in the comments for the rpc method.

I'm not confusing anything, I just think the same reasons why we might not want role in the cli output also apply to why we might not want it in the api response. Either way works tho, it's a minor/cosmetic change and I was just sharing my opinion.

@kilrau
Copy link
Contributor

kilrau commented Nov 12, 2018

r_hash and preimage should be together. Both included or both excluded.

Agree and let's include it for now for testing purposes of outside testers.

Here again we confuse the CLI level with with the RPC calls/objects. The
point here is that there is no value to should the role as part of
placeorder CLI command since it will always be 'taker`.
IMHO This simple change should be done on the CLI level and not on the
backend level

That's correct, but it's fine - a minor change and Daniel already agreed on removing it.

@kilrau
Copy link
Contributor

kilrau commented Nov 12, 2018

Regarding subscribeSwaps , we always try to discuss these things in a group, multiple reviews of PRs - it's never to put on one ;)

Let's re-open the discussion about subscribeSwaps in nomatching mode from what we know today. Main calls are:

  • executeSwap executes an atomic swap in a matter of with a remote peer. You can continue using your internal orderIDs, xud takes care of mapping such with orderIDs in the network. The swap might take up to several seconds to complete.
  • subscribeSwaps informs about successful/failed swaps with other peers in an event stream, use this call to determine when to remove an order from your internal order book.

I suggest we offer the same SYNC + ASYNC way to update about a swap result as we offer for placeOrder. Meaning executeSwap can be called SYNC and delivers final swap results once everything is done OR can be called ASYNC, just delivers an immediate ACK if in xud is all good and all results come in by the time they occure via subscribeSwaps eventstream. Since only the taker calls executeSwap, this includes the taker.

I understand this is not implemented yet, hence would open an issue. Agree/different opinions about my suggestion? @offerm @sangaman

@sangaman
Copy link
Collaborator

The rpc subscription methods were discussed a ton (see #123 and #500). If we want to discuss more or about executeSwap that's fine but I don't think it should be in this issue because it's unrelated and will make the discussion harder to follow. In short I don't see the need for the changes and I think it would add complexity.

@kilrau
Copy link
Contributor

kilrau commented Nov 17, 2018

Taking the subscribeSwap discussion out, this issue is ready to go @ImmanuelSegol : #656 (comment)

@kilrau kilrau modified the milestones: 1.0.0-alpha.5, 1.0.0-alpha.6 Dec 5, 2018
@kilrau kilrau added the has PR issues with an open PR label Dec 6, 2018
@kilrau kilrau modified the milestones: 1.0.0-alpha.6, 1.0.0-alpha.8 Jan 2, 2019
@kilrau kilrau modified the milestones: 1.0.0-alpha.7, 1.0.0-alpha.8 Jan 23, 2019
@kilrau kilrau modified the milestones: 1.0.0-alpha.8, 1.0.0-alpha.9 Feb 5, 2019
@ghost ghost removed the in progress label Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request has PR issues with an open PR
Projects
None yet
Development

No branches or pull requests

4 participants