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

Messaging inconcistencies? #378

Open
compojoom opened this issue May 19, 2020 · 2 comments
Open

Messaging inconcistencies? #378

compojoom opened this issue May 19, 2020 · 2 comments

Comments

@compojoom
Copy link
Contributor

const paymentRequest = {

I'm looking at the paymentRequest function and I find it somewhat confusing.

The payment request has a from and to props. Then we construct a message for the relay server and add counterParty and user that are equal to toand from.

At the end we return basically the const message defined on line 71, but override the direction. Hä, why do we override it? Why do we set the direction to "received" when we send the request to the relay server and then we return direction set to sent?

paymentRequestDecline accepts a counterPartyAddress and an id to decline. Then it returns a message object. The returned id however is set to the id that we are trying to decline. That's confusing - I would expect that paymentRequest and paymentRequestDecline generate different ids. At the end - those are unique actions. They should be connected through the use of a meta flag or a prop such as foreign_id -> to indicate the id of the message deleted.

The message returned from paymentMessage has no idprop at all? For the sake of uniformity I would have an id for paymentMessage as well.

@dohaki
Copy link
Contributor

dohaki commented May 19, 2020

At the end we return basically the const message defined on line 71, but override the direction. Hä, why do we override it? Why do we set the direction to "received" when we send the request to the relay server and then we return direction set to sent?

I think I wrote that back then, so I can give you an answer for that at least. A message always has a sender and receiver which in our context are users. So if we assume that user A wants to send a payment request to user B, then the direction of that message is different depending on the point of view. User A calls the function which sends the message to user B, so from the point of view of the sender the direction of the returned message is sent. For user B who receives the message the direction is received respectively.

@compojoom
Copy link
Contributor Author

I guess I'm still missing the big picture/context.

A message has a to and from props. So the direction is always from to to from. (😃 wow, that's a funny sentence) Why does the message sent to the relay server needs a direction in the first place?I guess that no matter the direction - it will send it to "to" from "from" 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants