Skip to content

Demo sender fallback#1510

Open
arminsabouri wants to merge 2 commits intopayjoin:masterfrom
arminsabouri:demo-sender-fallback
Open

Demo sender fallback#1510
arminsabouri wants to merge 2 commits intopayjoin:masterfrom
arminsabouri:demo-sender-fallback

Conversation

@arminsabouri
Copy link
Copy Markdown
Collaborator

@arminsabouri arminsabouri commented Apr 28, 2026

Code migrated from #1164. There were many conflicts.

The tricky thing with v2 is we don't want to fallback when there is a transient error. Luckly, our session outcome abstracts all that away. If after a replay a session is closed due to either a failure or cancellation we broadcast the fallback. But this requires a replay. Say your payjoin proposal was faulty, currently you have to resume again for the fallback to be broadasted which I think defeats the purpose of a "demo". i.e what we wants devs to replicate in their apps.

Instead, internally in Pj-cli we can replay again if an error occured (or if #1197 we can avoid disk reads) check if the session is closed and fallback accordingly.

cc @zealsham @chavic

Pull Request Checklist

Please confirm the following before requesting review:

Co-authored-by: zealsham <shammahagwor@gmail.com>

If the v1 sender fails to post the original proposal or process the
payjoin then they broadcast the fallback tx.
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 28, 2026

Coverage Report for CI Build 25166916130

Coverage increased (+0.2%) to 85.159%

Details

  • Coverage increased (+0.2%) from the base build.
  • Patch coverage: 2 uncovered changes across 1 file (100 of 102 lines covered, 98.04%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
payjoin-cli/src/app/v2/mod.rs 102 100 98.04%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
payjoin-cli/src/app/v1.rs 1 69.62%

Coverage Stats

Coverage Status
Relevant Lines: 13530
Covered Lines: 11522
Line Coverage: 85.16%
Coverage Strength: 397.15 hits per line

💛 - Coveralls

@DanGould
Copy link
Copy Markdown
Contributor

What's left to do here? Just a v2 fallback test? Or we're still not handling the v2 case completely and a decision needs to be made on the experience?

@arminsabouri arminsabouri force-pushed the demo-sender-fallback branch from 1d59adf to 88effb0 Compare April 30, 2026 12:59
Co-authored-by: zealsham <shammahagwor@gmail.com>

After a replay, if the session is closed due to being cancled or failure
we broadcast the fallback.
@arminsabouri arminsabouri force-pushed the demo-sender-fallback branch from 88effb0 to 72c21a6 Compare April 30, 2026 13:03
@arminsabouri
Copy link
Copy Markdown
Collaborator Author

What's left to do here? Just a v2 fallback test? Or we're still not handling the v2 case completely and a decision needs to be made on the experience?

I decided a second resume was not the way forward. PJ cli will replay and check for the fallback condition before exiting the app. Fall back test was added as a integration test in pj cli as opposed to a e2e test. Creating e2e conditions for protocol failure was tricky without manually updating the db. Integration test ended up being simpler .

@arminsabouri arminsabouri marked this pull request as ready for review April 30, 2026 13:04
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

Successfully merging this pull request may close these issues.

3 participants