Skip to content

process_response methods need to handle failures consistently #1066

Closed

Description

@spacebear21

In Sender<WithReplyKey>, Sender<V2GetContext>, and Receiver<Initialized> when we process the ohttp response, any error is treated as a fatal state transition.

In Receiver<PayjoinProposal> any error is treated as a transient error.

The correct thing to do is probably to support transient and fatal transitions in all of these, depending on what actually happened (MaybeFatalTransition already supports this, but transient errors are never returned in those process_responses currently). Some network errors may be transient and retryable, others like ohttp decapsulation failures are always fatal.

Activity

  1. added this to the payjoin-1.0 milestone on Sep 12, 2025
  2. arminsabouri commented on Sep 15, 2025

    @arminsabouri
    Contributor

    There are three error variants in PayjoinProposal::process_response

    pub enum DirectoryResponseError {
        InvalidSize(usize),
        OhttpDecapsulation(OhttpEncapsulationError),
        UnexpectedStatusCode(http::StatusCode),
    }

    It would make sense to match on the sepcific http error. If 5xx we can try again so that is a transient error. If 4xx I am not sure what the recourse would be -- lets say the server OHTTP key rotated that may also be a fatal error for now .

  3. self-assigned this
    on Sep 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions