refactor: Handle payjoin persisted errors and fallback - #151
Draft
ValeraFinebits wants to merge 3 commits into
Draft
refactor: Handle payjoin persisted errors and fallback#151ValeraFinebits wants to merge 3 commits into
ValeraFinebits wants to merge 3 commits into
Conversation
Bumps [rust-payjoin](https://github.com/payjoin/rust-payjoin) from `a5ff964` to `b02a6cc`. - [Release notes](https://github.com/payjoin/rust-payjoin/releases) - [Commits](payjoin/rust-payjoin@a5ff964...b02a6cc) --- updated-dependencies: - dependency-name: rust-payjoin dependency-version: b02a6ccb02392e8b986092fb5c035519f9fe1fbe dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors receiver recovery, ownership checks, and seen-input persistence for safer Payjoin fallback handling.
Changes:
- Handles persisted errors and closes replayed pending fallbacks.
- Resolves input ownership by exact historical outpoints.
- Atomically persists seen inputs with receiver-session events.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
PayjoinWalletOwnershipService.cs |
Adds outpoint-based ownership resolution. |
PayjoinSeenInputStore.cs |
Stages seen inputs with session transitions. |
PayjoinReceiverStateProcessor.cs |
Processes ownership, fallback, and atomic seen-input transitions. |
PayjoinReceiverSessionProcessor.cs |
Handles persisted errors and pending fallbacks. |
PayjoinReceiverSessionGuard.cs |
Restores original transaction facts during replay. |
PayjoinAvailabilityService.cs |
Documents cold-wallet readiness requirement. |
IPayjoinReceiverStateProcessor.cs |
Extends state-processing contracts and context. |
Plugin.cs |
Updates service construction. |
UIStorePayjoinController.cs |
Documents cold-wallet tracking limitations. |
GreenfieldPayjoinController.cs |
Documents cold-wallet tracking limitations. |
PayjoinReceiverStateProcessorTests.cs |
Tests ownership and transaction extraction. |
PayjoinReceiverSessionProcessorTests.cs |
Tests persistence failures and fallback dispatch. |
RelationalPluginTestSupport.cs |
Adds persistence-race test hooks. |
PayjoinSettlementFlowTests.cs |
Updates processor test implementation. |
PayjoinReceiverSessionStoreRelationalTests.cs |
Tests atomic seen-input persistence. |
PayjoinWalletOwnershipIntegrationTests.cs |
Tests historical and cold-wallet ownership. |
PayjoinPluginIntegrationTests.cs |
Verifies rejected-proposal fallback closure. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Handle payjoin persisted errors and fallback
Atomic seen-input check.
PayjoinSeenInputStorecommitted each inspected outpoint on its own,so a failure partway through left inputs recorded with no matching session event and the retry of
the same proposal rejected itself against its own leftovers.
ExecuteSeenInputTransitionnowstages the callback's writes and flushes them with the single
SaveChangesthat appends the event.The transaction stays implicit because the Npgsql context enables retry-on-failure, which refuses
user-initiated transactions.
Persisted errors.
ReceiverPersistedExceptionis caught and the stored session retained: theexception cannot say what reached the database, so the next tick's replay decides.
ReceiverPendingFallback. The state a rejected proposal replays into previously fell throughthe dispatch switch and polled until expiry; it is now closed explicitly, and
ProcessReplyableErrorAsyncsaves the transition that produces it.Tests. Session retention/retry across Transient/Storage/Fatal failures, PendingFallback
dispatch, seen-input rollback and cross-session visibility. The same-wallet integration test now
asserts the proposal is rejected instead of waiting out the timeout.