Draft
Conversation
Collaborator
Coverage Report for CI Build 24111378470Coverage decreased (-0.2%) to 84.144%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
589cf61 to
3f2e13e
Compare
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.
DanGould
reviewed
Apr 14, 2026
Contributor
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.