Conversation
Coverage Report for CI Build 24473537273Coverage increased (+0.03%) to 84.368%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
589cf61 to
3f2e13e
Compare
There was a problem hiding this comment.
soft/draft ACK 3f2e13e assuming mutants issues can be explained. This design is simple to understand. Draft just because it's not yet in payjoin-cli? I don't think we'll be able to confidently answer whether the ergonomics of this are correct nor if the other accessors can be deleted until the reference implementation adopts it. Not sure if that looks like #1164 or your own implementation in this PR. But I have a strong hunch this is the right direction and am comfortable even merging before we have such confidence because so much discussion around this already landed on this design.
Reviewing per the discussion in #1470
does cancel():
- immediately close the session with
SessionOutcome(Cancel) - return the fallback transaction to broadcast.
Ya you have tests for these
|
I agree on the iterative approach for ergonomics. I should have taken this out of draft. The mutants are there because I need to test every single typestate's |
This exposes a public API for canceling an active Payjoin session. This serves both manual triggers such as user action to "accelerate" a payment by immediately broadcasting the fallback, or automatic ones such as receiver wallet incapable of providing suitable inputs for a Payjoin. When applicable, it returns the fallback transaction both as a convenience and as a "hint" for the implementer to broadcast it now that the Payjoin is canceled.
3f2e13e to
51eb814
Compare
|
Updated the unit testing to go through every typestate and check the presence/absence of a fallback tx |
This implements a generic cancel() method on the Receiver, following up on discussion from #1134.
As discussed on the PR review club a few weeks ago, this implementation of cancel() returns the fallback transaction as a convenience and a "hint" to broadcast it if it hasn't already been. Doing this adds quite a bit of complexity due to having to implement a
fallback_txgetter for every concrete typestate, some of which returnNone. IMO the ergonomics are probably worth the cost of this internal ugliness, but I'm curious what other people think.The existing flow is for implementers to call
extract_tx_to_schedule_broadcastafter the broadcast suitability check passes and store that somewhere for broadcasting later, or to replay events and useSessionHistory::fallback_txto access it for broadcasting. This PR introduces a third accessor for the same data. Is there still a need for the other two getters if we aim to encouragecancel()ing?Supersedes #1134.
Authored with Claude - who incidentally has learned to generate all downstream language bindings and run their tests in parallel in the background while doing other things.
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.