Skip to content

Commit 12539ef

Browse files
committed
Remove ReceiveSession::TerminalFailure
`TerminalFailure` was never a real state in the receiver state machine. Instead, a SessionEvent::Closed simply results in an empty `()` next state.
1 parent fbed31b commit 12539ef

3 files changed

Lines changed: 1 addition & 9 deletions

File tree

  • payjoin-cli/src/app/v2
  • payjoin-ffi/src/receive
  • payjoin/src/core/receive/v2

payjoin-cli/src/app/v2/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ impl StatusText for ReceiveSession {
7171
| ReceiveSession::ProvisionalProposal(_) => "Processing original proposal",
7272
ReceiveSession::PayjoinProposal(_) => "Payjoin proposal sent",
7373
ReceiveSession::HasReplyableError(_) => "Session failure",
74-
ReceiveSession::TerminalFailure => "Session failure",
7574
}
7675
}
7776
}
@@ -524,8 +523,6 @@ impl App {
524523
self.send_payjoin_proposal(proposal, persister).await,
525524
ReceiveSession::HasReplyableError(error) =>
526525
self.handle_error(error, persister).await,
527-
ReceiveSession::TerminalFailure =>
528-
return Err(anyhow!("Terminal receiver session")),
529526
}
530527
};
531528
res

payjoin-ffi/src/receive/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ pub enum ReceiveSession {
7979
ProvisionalProposal { inner: Arc<ProvisionalProposal> },
8080
PayjoinProposal { inner: Arc<PayjoinProposal> },
8181
HasReplyableError { inner: Arc<HasReplyableError> },
82-
TerminalFailure,
8382
}
8483

8584
impl From<payjoin::receive::v2::ReceiveSession> for ReceiveSession {
@@ -108,7 +107,6 @@ impl From<payjoin::receive::v2::ReceiveSession> for ReceiveSession {
108107
Self::PayjoinProposal { inner: Arc::new(inner.into()) },
109108
ReceiveSession::HasReplyableError(inner) =>
110109
Self::HasReplyableError { inner: Arc::new(inner.into()) },
111-
ReceiveSession::TerminalFailure => Self::TerminalFailure,
112110
}
113111
}
114112
}

payjoin/src/core/receive/v2/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn short_id_from_pubkey(pubkey: &HpkePublicKey) -> ShortId {
122122
}
123123

124124
/// Represents the various states of a Payjoin receiver session during the protocol flow.
125-
/// Each variant parameterizes a `Receiver` with a specific state type, and [`ReceiveSession::TerminalFailure`] which indicates the session has ended or is invalid.
125+
/// Each variant parameterizes a `Receiver` with a specific state type.
126126
///
127127
/// This provides type erasure for the receive session state, allowing for the session to be replayed
128128
/// and the state to be updated with the next event over a uniform interface.
@@ -139,7 +139,6 @@ pub enum ReceiveSession {
139139
ProvisionalProposal(Receiver<ProvisionalProposal>),
140140
PayjoinProposal(Receiver<PayjoinProposal>),
141141
HasReplyableError(Receiver<HasReplyableError>),
142-
TerminalFailure,
143142
}
144143

145144
impl ReceiveSession {
@@ -204,8 +203,6 @@ impl ReceiveSession {
204203
ReceiveSession::ProvisionalProposal(r) => r.session_context,
205204
ReceiveSession::PayjoinProposal(r) => r.session_context,
206205
ReceiveSession::HasReplyableError(r) => r.session_context,
207-
ReceiveSession::TerminalFailure =>
208-
return Ok(ReceiveSession::TerminalFailure),
209206
},
210207
})),
211208

0 commit comments

Comments
 (0)