Skip to content

Does the payjoin-cli cancel have the correct semantics? #1605

Closed

Description

@benalleng

Quoted from #1558 (review)

I thought about the cancel --no-broadcast semantics in review and confirm I think this is the correct semantics. cancel matches cancel() & SessionOutcome::Cancel and defaults to a broadcast. If you want the special case where you don't broadcast that's an option with --no-broadcast.

Perhaps though, we separate cancel (which can mean stop broadcasting a transaction that pays the counterparty in RBF cancel) into abort and abort --broadcast, flipping the semantics. What's weird here is after cancel payjoin-cli has no way to broadcast a transaction by replaying until the PendingFallback state. I think we want there to be a way to broadcast the fallback on a closed session, but that's a matter for payjoin-cli-1.0, not the payjoin-1.0 milestone issue this PR tries to address.

Activity

  1. benalleng commented on Jun 5, 2026

    @benalleng
    CollaboratorAuthor

    Just to additionally weigh in here I do think its important to keep in mind that the payjoin-cli commands are payjoin focused so that a bare cargo run cancel will simply not proceed the payjoin but the transaction can still proceed whereas cargo run cancel --no-broadcast is a special case beyond just cancelling the payjoin.

  2. added this to the payjoin-cli-1.0 milestone on Jun 8, 2026
  3. spacebear21 commented on Jun 17, 2026

    @spacebear21
    Collaborator

    What's weird here is after cancel payjoin-cli has no way to broadcast a transaction by replaying until the PendingFallback state. I think we want there to be a way to broadcast the fallback on a closed session

    Would it be sufficient to add a way to retrieve the raw fallback transaction so that it can be broadcasted with e.g. bitcoin-cli sendrawtransaction? Perhaps in payjoin-cli history output or similar. For example on failure closes we simply print:

    println!("Payjoin failed. To broadcast the fallback transaction, run:");
    println!(
        "  bitcoin-cli -rpcwallet=<wallet> sendrawtransaction {:#}",
  4. benalleng commented on Jun 22, 2026

    @benalleng
    CollaboratorAuthor

    I'm a bit confused looking at the cli which session state you are hoping to add this additional information at. Would we want this print to go alongside the print here?

    SendSession::PendingFallback(_) => {
    let id = persister.session_id();
    println!(
    "Session {id} was cancelled. Run `payjoin-cli cancel {id}` to cancel and broadcast the fallback transaction."
    );
    return Ok(());

    and for the receiver
    ReceiveSession::PendingFallback(_) => {
    let id = persister.session_id();
    println!(
    "Session {id} was cancelled. Run `payjoin-cli cancel {id}` to cancel and broadcast the fallback transaction."
    );
    return Ok(());

    Or should this be instead of the cancel suggestion?

  5. bc1cindy commented on Jun 24, 2026

    @bc1cindy
    Contributor

    concept ACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions