Skip to content

Consume self in Monitor check_for_transaction#1729

Merged
spacebear21 merged 1 commit into
payjoin:masterfrom
xstoicunicornx:consume-self
Jul 13, 2026
Merged

Consume self in Monitor check_for_transaction#1729
spacebear21 merged 1 commit into
payjoin:masterfrom
xstoicunicornx:consume-self

Conversation

@xstoicunicornx

Copy link
Copy Markdown
Collaborator

Take the receiver by value instead of by reference so the state machine no longer needs internal clones to construct transient and stasis transitions. Callers get the current state back through Stasis outcomes or transient errors, matching the pattern used by the other receiver transitions.

Update the CLI monitoring loop to rebind the state from Stasis and transient-error outcomes instead of reusing a borrowed receiver, and clone the monitor in the typestate unit test where it is exercised multiple times.

This comes out of a suggested update from #1724 (comment).

Claude Fable was used to help make these edits.

Pull Request Checklist

Please confirm the following before requesting review:

Take the receiver by value instead of by reference so the state
machine no longer needs internal clones to construct transient and
stasis transitions. Callers get the current state back through
Stasis outcomes or transient errors, matching the pattern used by
the other receiver transitions.

Update the CLI monitoring loop to rebind the state from Stasis and
transient-error outcomes instead of reusing a borrowed receiver, and
clone the monitor in the typestate unit test where it is exercised
multiple times.
@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 29125172829

Coverage increased (+0.004%) to 86.014%

Details

  • Coverage increased (+0.004%) from the base build.
  • Patch coverage: 8 uncovered changes across 2 files (8 of 16 lines covered, 50.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
payjoin-cli/src/app/v2/mod.rs 9 4 44.44%
payjoin/src/core/receive/v2/mod.rs 7 4 57.14%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 15880
Covered Lines: 13659
Line Coverage: 86.01%
Coverage Strength: 343.67 hits per line

💛 - Coveralls

@spacebear21 spacebear21 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concept ACK - check_for_transaction is a bit of an awkward method currently but this seems worth it for the consistency win until #1692 is revisted.

@spacebear21 spacebear21 merged commit 7422a34 into payjoin:master Jul 13, 2026
13 checks passed
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