Sender Pending Fallback state#1557
Conversation
7cf2e7c to
d3dac67
Compare
Coverage Report for CI Build 26187598484Coverage decreased (-0.1%) to 85.14%Details
Uncovered Changes
Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats
💛 - Coveralls |
d3dac67 to
cefae94
Compare
38ef7b3 to
402848a
Compare
|
concept ACK just like #1558 |
402848a to
b6040c7
Compare
| /// Indicates that the fallback transaction has been broadcast and the session is complete. | ||
| pub fn broadcasted( | ||
| &self, | ||
| ) -> MaybeSuccessTransition<SessionEvent, (), std::convert::Infallible> { |
There was a problem hiding this comment.
std::convert::Infallible bc this method can never fail due to a API error.
There was a problem hiding this comment.
TerminalTransition is more appropriate
b6040c7 to
c57d338
Compare
xstoicunicornx
left a comment
There was a problem hiding this comment.
utACK c57d338
Somewhat strongly held nit: changing from SessionOutcome::Cancel to SessionOutcome::Aborted makes it more confusing/less intuitive. It gives two different terms that refer to the same state transition path. Was there a reason you felt that SessionOutcome::Aborted was better? I do think Cancelled is better than Cancel though.
Other than my nits and the comment that seems like it can be removed, implementation looks good and all tests pass.
spacebear21
left a comment
There was a problem hiding this comment.
Approach ACK, I have a couple of naming questions and a CLI ergonomics question (both also relevant for the receiver PR).
| /// Payjoin was cancelled by the user | ||
| Cancel, | ||
| /// Payjoin was aborted by the user | ||
| Aborted, |
There was a problem hiding this comment.
@xstoicunicornx I think this rename originated from my suggestion here to collapse the Cancel and Failure outcomes into one variant? The idea was that we can tell whether it was a failure or a cancel by looking at the session event log and seeing whether a Cancelled event occurred, vs. a Failed event. Then we wouldn't need the distinction at the SessionOutcome level.
@arminsabouri is this your understanding as well? Is the goal here with the rename to implement the rest of that idea in a follow-up?
There was a problem hiding this comment.
yeah that was the idea. I am going to revert the naming change. I think this is best left as a follow up after this PR and maybe #1558
| Ok(()) | ||
| } | ||
|
|
||
| async fn cancel_sender(&self, session_id: SessionId) -> Result<()> { |
There was a problem hiding this comment.
Since the cancel and fallback commands are so similar, I wonder if it would be more ergonomic to combine them into a single cancel command, which could either prompt the user for whether to broadcast the fallback, or default to fallback=true with an optional parameter to not broadcast.
There was a problem hiding this comment.
Ack. If fallback=false, we can print the serialized tx. But cancel should ultimately close the session
c57d338 to
c338544
Compare
If application manually cancels the assumption is they will not attempt to resume that session again. The session is marked closed. The cancel type leaves the session open and the session can only be closed once the user confirms they broadcasted the fallback tx -- or took an equivalent action.
Unifying them removes the two-command workflow: `cancel` now cancels the session and broadcasts the fallback transaction by default. Pass `--no-broadcast` to print the raw transaction hex instead for manual broadcast.
c338544 to
3bb4625
Compare
Implementing @spacebear21 's idea from #1542 (comment)
for just the sender.
Recevier side is implemented here: #1558
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.
Claude made the updates to the payjoin-cli