Skip to content

refactor: Add RunTestPaymentService and self-pay checks#4

Open
ValeraFinebits wants to merge 1 commit intomasterfrom
refactor/Add-RunTestPaymentService-and-self-pay-checks
Open

refactor: Add RunTestPaymentService and self-pay checks#4
ValeraFinebits wants to merge 1 commit intomasterfrom
refactor/Add-RunTestPaymentService-and-self-pay-checks

Conversation

@ValeraFinebits
Copy link
Copy Markdown
Owner

This PR stabilizes the RunTestPayment([FromBody] RunTestPaymentRequest, CancellationToken) self-pay diagnostic flow and makes failures easier to understand.

RunTestPayment([FromBody] RunTestPaymentRequest, CancellationToken) is a cheat-mode-only scenario where sender and receiver can operate against the same store wallet. That makes it useful for finding same-wallet payjoin edge cases, but it also exposed a flaky dust-output failure caused by sender/receiver change handling colliding in this self-pay path.

Changes

  • fixed the self-pay dust issue by reserving the sender change address before building the payjoin proposal;
  • extracted the self-pay workflow into RunTestPaymentService;
  • extracted same-wallet diagnostic checks into SelfPayInvariantChecker;
  • improved invariant logging by splitting warning summary from full debug diagnostics;
  • added targeted unit coverage and kept the self-pay integration flow passing.

added explicit self-pay invariant validation for:

  • invoice output preservation,
  • receiver contribution,
  • sender change script reuse,
  • zero-value outputs,
  • dust outputs;

Why

This keeps RunTestPayment([FromBody] RunTestPaymentRequest, CancellationToken) useful as a deliberately weird same-wallet diagnostic scenario, while making it less flaky and much more actionable when it fails.

@ValeraFinebits ValeraFinebits marked this pull request as ready for review April 6, 2026 17:39
@ValeraFinebits ValeraFinebits requested a review from chavic April 6, 2026 17:39
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