Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions payjoin-cli/src/app/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ impl StatusText for SendSession {
SendSession::WithReplyKey(_) | SendSession::PollingForProposal(_) =>
"Waiting for proposal",
SendSession::Closed(session_outcome) => match session_outcome {
SenderSessionOutcome::Failure => "Session failure",
SenderSessionOutcome::Aborted => "Session aborted",
SenderSessionOutcome::Success(_) => "Session success",
SenderSessionOutcome::Cancel => "Session cancelled",
},
SendSession::PendingFallback(_) => "Session awaiting fallback",
}
Expand All @@ -82,9 +81,8 @@ impl StatusText for ReceiveSession {
ReceiveSession::Monitor(_) => "Monitoring payjoin proposal",
ReceiveSession::PendingFallback(_) => "Pending fallback handling",
ReceiveSession::Closed(session_outcome) => match session_outcome {
ReceiverSessionOutcome::Failure => "Session failure",
ReceiverSessionOutcome::Aborted => "Session aborted",
ReceiverSessionOutcome::Success(_) => "Session success, Payjoin proposal was broadcasted",
ReceiverSessionOutcome::Cancel => "Session cancelled",
ReceiverSessionOutcome::FallbackBroadcasted => "Fallback broadcasted",
ReceiverSessionOutcome::PayjoinProposalSent =>
"Payjoin proposal sent, skipping monitoring as the sender is spending non-SegWit inputs",
Expand Down Expand Up @@ -404,7 +402,7 @@ impl AppTrait for App {
let row = SessionHistoryRow {
session_id,
role: Role::Sender,
status: SendSession::Closed(SenderSessionOutcome::Failure),
status: SendSession::Closed(SenderSessionOutcome::Aborted),
completed_at: None,
error_message: Some(e.to_string()),
};
Expand All @@ -430,7 +428,7 @@ impl AppTrait for App {
let row = SessionHistoryRow {
session_id,
role: Role::Receiver,
status: ReceiveSession::Closed(ReceiverSessionOutcome::Failure),
status: ReceiveSession::Closed(ReceiverSessionOutcome::Aborted),
completed_at: None,
error_message: Some(e.to_string()),
};
Expand All @@ -457,7 +455,7 @@ impl AppTrait for App {
let row = SessionHistoryRow {
session_id,
role: Role::Sender,
status: SendSession::Closed(SenderSessionOutcome::Failure),
status: SendSession::Closed(SenderSessionOutcome::Aborted),
completed_at: Some(completed_at),
error_message: Some(e.to_string()),
};
Expand Down Expand Up @@ -485,7 +483,7 @@ impl AppTrait for App {
let row = SessionHistoryRow {
session_id,
role: Role::Receiver,
status: ReceiveSession::Closed(ReceiverSessionOutcome::Failure),
status: ReceiveSession::Closed(ReceiverSessionOutcome::Aborted),
completed_at: Some(completed_at),
error_message: Some(e.to_string()),
};
Expand Down Expand Up @@ -665,8 +663,7 @@ impl App {
self.process_pj_response(proposal)?;
return Ok(());
}
SendSession::Closed(SenderSessionOutcome::Failure)
| SendSession::Closed(SenderSessionOutcome::Cancel) => {
SendSession::Closed(SenderSessionOutcome::Aborted) => {
println!("Session is closed. Nothing left to do");
return Ok(());
}
Expand Down
8 changes: 2 additions & 6 deletions payjoin-ffi/src/send/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,8 @@ impl SenderSessionOutcome {
}
}

pub fn is_failure(&self) -> bool {
matches!(self.0, payjoin::send::v2::SessionOutcome::Failure)
}

pub fn is_cancelled(&self) -> bool {
matches!(self.0, payjoin::send::v2::SessionOutcome::Cancel)
pub fn is_aborted(&self) -> bool {
matches!(self.0, payjoin::send::v2::SessionOutcome::Aborted)
}
}

Expand Down
Loading
Loading