decred / dcrwallet

A secure Decred wallet daemon written in Go (golang).
https://decred.org
ISC License
216 stars 155 forks source link

Add a stream PurchaseTicket grpc call. #2296

Open amass01 opened 11 months ago

amass01 commented 11 months ago

Currently the PurchaseTicket grpc returns one response when it's done. Because of this limitation the ticket purchase UX in decrediton is not smooth as users don't get any feedback during the process. See https://github.com/decred/decrediton/issues/3926.

We would like to add a stream grpc call, which will allow us return various statuses during the process and would make the call cancellable.

@alexlyp @jrick Any idea which statuses would be helpful here, I will inspect the current func flow and see at which stages it would make sense to return an update to the consumer.

jrick commented 11 months ago

The call should already be cancellable. Are you seeing otherwise?

I assume this request is mostly about mixed ticket buying, because of the potentially long wait period for a mix to occur? There is not much other information to provide during this.

amass01 commented 11 months ago

The call should already be cancellable. Are you seeing otherwise?

Oh yea haven't tried, probably it's cancellable, but not in the GUI, how does the cancel work ? is it by context cancellation ?

I assume this request is mostly about mixed ticket buying, because of the potentially long wait period for a mix to occur? There is not much other information to provide during this.

Yes, so probably we can return when mixing started and mixed balance / ticket price each time the mixed balance changes ?

jrick commented 11 months ago

The call should already be cancellable. Are you seeing otherwise?

Oh yea haven't tried, probably it's cancellable, but not in the GUI, how does the cancel work ? is it by context cancellation ?

Yep, with the context. I'm not sure how this works on the javascript side, but you should be able to cancel a specific ongoing request.

I assume this request is mostly about mixed ticket buying, because of the potentially long wait period for a mix to occur? There is not much other information to provide during this.

Yes, so probably we can return when mixing started and mixed balance / ticket price each time the mixed balance changes ?

I'm not sure what you mean by mixed balance. If you mean the ticket price it buys at, and the (slightly higher) value of the mixed outputs from the split tx, this doesn't change over the duration of the call. The request should error out if the ticket price changes because the window rolls over. I know the autobuyer does this, but I think calling PurchaseTickets directly might not (the mix might still complete, but the ticket purchase would fail).