Skip to content

refactor: refactor payjoin receiver poller#23

Draft
ValeraFinebits wants to merge 2 commits into
feat/improve-error-handlingfrom
refactor/Refactor-PayjoinReceiverPoller
Draft

refactor: refactor payjoin receiver poller#23
ValeraFinebits wants to merge 2 commits into
feat/improve-error-handlingfrom
refactor/Refactor-PayjoinReceiverPoller

Conversation

@ValeraFinebits
Copy link
Copy Markdown
Owner

This PR is based on #20 and should be merged after it.

Refactored the payjoin receiver pipeline to break the old PayjoinReceiverPoller monolith into focused, testable services while preserving behavior.

What changed

  • Reduced PayjoinReceiverPoller to a thin hosted worker
  • Kept orchestration in PayjoinReceiverSessionProcessor
  • Extracted dedicated services for:
  • relay transport
  • receiver state transitions
  • exact-payment output building
  • receiver input selection
  • proposal signing / PSBT normalization
  • proposal finalization / posting
  • session lifecycle / replay / guard preparation

New services

  • PayjoinReceiverSessionGuard
  • PayjoinReceiverRelayClient
  • PayjoinReceiverStateProcessor
  • PayjoinReceiverOutputBuilder
  • PayjoinReceiverInputSelector
  • PayjoinReceiverProposalSigner
  • PayjoinReceiverProposalFinalizer

Other updates

  • Updated DI registrations in Plugin.cs
  • Split helper-focused tests into dedicated test files

Notes

This PR is primarily a structural refactor. One intentional nuance is that expired sessions are now filtered by the session guard earlier in the processing flow, which is acceptable and keeps cleanup responsibility in one place.

@ValeraFinebits ValeraFinebits requested review from Copilot and removed request for Copilot May 6, 2026 16:02
@ValeraFinebits ValeraFinebits requested review from Copilot and removed request for Copilot May 6, 2026 16:34
@ValeraFinebits ValeraFinebits marked this pull request as ready for review May 6, 2026 16:42
@ValeraFinebits ValeraFinebits requested review from Copilot and removed request for Copilot May 6, 2026 16:42
@ValeraFinebits ValeraFinebits requested review from chavic and removed request for Copilot May 6, 2026 16:48
@ValeraFinebits ValeraFinebits marked this pull request as draft May 11, 2026 12:15
@ValeraFinebits ValeraFinebits changed the base branch from master to feat/improve-error-handling May 11, 2026 12:15
@ValeraFinebits ValeraFinebits force-pushed the refactor/Refactor-PayjoinReceiverPoller branch from ce93eef to 3be9840 Compare May 11, 2026 12:17
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.

1 participant