Skip to content

Commit 1118670

Browse files
committed
Rename TerminalState to TerminalFailure
It's always a failure state.
1 parent ab142b3 commit 1118670

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl App {
307307
self.send_payjoin_proposal(proposal, persister).await,
308308
ReceiverTypeState::Uninitialized(_) =>
309309
return Err(anyhow!("Uninitialized receiver session")),
310-
ReceiverTypeState::TerminalState =>
310+
ReceiverTypeState::TerminalFailure =>
311311
return Err(anyhow!("Terminal receiver session")),
312312
}
313313
};

payjoin-ffi/src/receive/uni.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub enum ReceiverTypeState {
4646
WantsInputs { inner: Arc<WantsInputs> },
4747
ProvisionalProposal { inner: Arc<ProvisionalProposal> },
4848
PayjoinProposal { inner: Arc<PayjoinProposal> },
49-
TerminalState,
49+
TerminalFailure,
5050
}
5151

5252
impl From<super::ReceiverTypeState> for ReceiverTypeState {
@@ -77,7 +77,7 @@ impl From<super::ReceiverTypeState> for ReceiverTypeState {
7777
PayjoinProposal(inner) => Self::PayjoinProposal {
7878
inner: Arc::new(super::PayjoinProposal::from(inner).into()),
7979
},
80-
TerminalState => Self::TerminalState,
80+
TerminalFailure => Self::TerminalFailure,
8181
}
8282
}
8383
}

payjoin-ffi/src/send/uni.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub enum SenderTypeState {
3939
WithReplyKey { inner: Arc<WithReplyKey> },
4040
V2GetContext { inner: Arc<V2GetContext> },
4141
ProposalReceived { inner: Arc<Psbt> },
42-
TerminalState,
42+
TerminalFailure,
4343
}
4444

4545
impl From<super::SenderTypeState> for SenderTypeState {
@@ -52,7 +52,7 @@ impl From<super::SenderTypeState> for SenderTypeState {
5252
V2GetContext(inner) =>
5353
Self::V2GetContext { inner: Arc::new(super::V2GetContext::from(inner).into()) },
5454
ProposalReceived(inner) => Self::ProposalReceived { inner: Arc::new(inner.into()) },
55-
TerminalState => Self::TerminalState,
55+
TerminalFailure => Self::TerminalFailure,
5656
}
5757
}
5858
}

payjoin/src/receive/v2/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fn subdir_path_from_pubkey(pubkey: &HpkePublicKey) -> ShortId {
8383
}
8484

8585
/// Represents the various states of a Payjoin receiver session during the protocol flow.
86-
/// Each variant wraps a `Receiver` with a specific state type, except for `TerminalState` which
86+
/// Each variant wraps a `Receiver` with a specific state type, except for `TerminalFailure` which
8787
/// indicates the session has ended or is invalid.
8888
#[derive(Debug, Clone, PartialEq)]
8989
pub enum ReceiverTypeState {
@@ -97,7 +97,7 @@ pub enum ReceiverTypeState {
9797
WantsInputs(Receiver<WantsInputs>),
9898
ProvisionalProposal(Receiver<ProvisionalProposal>),
9999
PayjoinProposal(Receiver<PayjoinProposal>),
100-
TerminalState,
100+
TerminalFailure,
101101
}
102102

103103
impl ReceiverTypeState {
@@ -143,7 +143,7 @@ impl ReceiverTypeState {
143143
ReceiverTypeState::ProvisionalProposal(state),
144144
SessionEvent::PayjoinProposal(payjoin_proposal),
145145
) => Ok(state.apply_payjoin_proposal(payjoin_proposal)),
146-
(_, SessionEvent::SessionInvalid(_, _)) => Ok(ReceiverTypeState::TerminalState),
146+
(_, SessionEvent::SessionInvalid(_, _)) => Ok(ReceiverTypeState::TerminalFailure),
147147
(current_state, event) => Err(InternalReplayError::InvalidStateAndEvent(
148148
Box::new(current_state),
149149
Box::new(event),

payjoin/src/send/v2/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub enum SenderTypeState {
167167
WithReplyKey(Sender<WithReplyKey>),
168168
V2GetContext(Sender<V2GetContext>),
169169
ProposalReceived(Psbt),
170-
TerminalState,
170+
TerminalFailure,
171171
}
172172

173173
impl SenderTypeState {
@@ -181,7 +181,7 @@ impl SenderTypeState {
181181
Ok(state.apply_v2_get_context(v2_get_context)),
182182
(SenderTypeState::V2GetContext(_state), SessionEvent::ProposalReceived(proposal)) =>
183183
Ok(SenderTypeState::ProposalReceived(proposal)),
184-
(_, SessionEvent::SessionInvalid(_)) => Ok(SenderTypeState::TerminalState),
184+
(_, SessionEvent::SessionInvalid(_)) => Ok(SenderTypeState::TerminalFailure),
185185
(current_state, event) => Err(InternalReplayError::InvalidStateAndEvent(
186186
Box::new(current_state),
187187
Box::new(event),

0 commit comments

Comments
 (0)