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
3 changes: 3 additions & 0 deletions payjoin-cli/changelog.d/cancel-no-broadcast-message.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- `cancel --no-broadcast` now says the session closed without broadcasting
the fallback transaction, and to broadcast it only if it isn't already on
chain and its inputs are unspent.
8 changes: 6 additions & 2 deletions payjoin-cli/src/app/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,9 @@ impl App {
};

if no_broadcast {
persister.print("Session cancelled. Broadcast the original transaction manually:");
persister.print(
"Session closed without broadcasting the fallback. If it isn't already on chain and its inputs are unspent, broadcast it yourself:",
);
println!("{}", serialize_hex(pending.fallback_tx()));
} else {
if let Err(e) = self.wallet().broadcast_tx(pending.fallback_tx()) {
Expand Down Expand Up @@ -813,7 +815,9 @@ impl App {
};

if no_broadcast {
persister.print("Session cancelled. Broadcast the fallback transaction manually:");
persister.print(
"Session closed without broadcasting the fallback. If it isn't already on chain and its inputs are unspent, broadcast it yourself:",
);
println!("{}", serialize_hex(pending.fallback_tx()));
} else {
if let Err(e) = self.wallet().broadcast_tx(pending.fallback_tx()) {
Expand Down
13 changes: 13 additions & 0 deletions payjoin-ffi/changelog.d/check-for-transaction-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- To migrate from `Monitor.check_for_transaction`:
- `close_session` on a `Monitor` records `PayjoinProposalSent` whichever
transaction resolved the session, where `check_for_transaction` recorded
`Success(txid)` or `FallbackBroadcasted`. Store `resolved_by` and the
txid yourself if the app needs them.
- `classify_tx` also classifies unconfirmed transactions. Call
`close_session` only once the transaction reaches the wallet's
confirmation depth.
- Non-SegWit senders no longer need special handling.
- A `Resolution` can't be persisted, so classify the transaction again
after a restart.
- `classify_tx` raises `TransactionParseError` for bytes that don't decode
as a transaction.
7 changes: 7 additions & 0 deletions payjoin-ffi/src/receive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ macro_rules! impl_resolution_for_receiver {
/// [`classify_tx`](Self::classify_tx) once its transaction has
/// enough confirmations.
///
/// The recorded [`ReceiverSessionOutcome`] says whether the receiver
/// completed its side of the Payjoin protocol and sent the Payjoin
/// proposal, not which transaction resolved the session. It is
/// `PayjoinProposalSent` if the proposal was posted or the Payjoin
/// resolved the session, and `Aborted` otherwise. The session does
/// not persist the [`ResolvedBy`] classification.
///
/// Returns a [`CloseTransition`] that, once persisted, closes the
/// receiver session.
pub fn close_session(&self, resolution: Arc<Resolution>) -> CloseTransition {
Expand Down
12 changes: 12 additions & 0 deletions payjoin/src/core/receive/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ impl ReceiveSession {
/// Call this with the [`Resolution`] returned by [`classify_tx`](Self::classify_tx) once its
/// transaction has enough confirmations.
///
/// The recorded [`SessionOutcome`] says whether the receiver completed its side of the Payjoin
/// protocol and sent the Payjoin proposal, not which transaction resolved the session. It is
/// [`SessionOutcome::PayjoinProposalSent`] if the proposal was posted or the Payjoin resolved
/// the session, and [`SessionOutcome::Aborted`] otherwise. The session does not persist the
/// [`ResolvedBy`] classification.
///
/// Returns a [`MaybeTerminalSuccessTransition`] that, once successfully persisted, closes the
/// receiver session.
pub fn close(
Expand Down Expand Up @@ -685,6 +691,12 @@ impl<S: HasFallbackTx> Receiver<S> {
/// Call this with the [`Resolution`] returned by [`classify_tx`](Self::classify_tx) once its
/// transaction has enough confirmations.
///
/// The recorded [`SessionOutcome`] says whether the receiver completed its side of the Payjoin
/// protocol and sent the Payjoin proposal, not which transaction resolved the session. It is
/// [`SessionOutcome::PayjoinProposalSent`] if the proposal was posted or the Payjoin resolved
/// the session, and [`SessionOutcome::Aborted`] otherwise. The session does not persist the
/// [`ResolvedBy`] classification.
///
/// Returns a [`MaybeTerminalSuccessTransition`] that, once successfully persisted, closes the
/// receiver session.
pub fn close(
Expand Down
Loading