Skip to content

Session ids should be something other than raw increments in payjoin-cli #1631

Closed

Description

@benalleng

coming from #1558 (comment)

This references the liana integration where a review comment asked what would happen if a wallet was imported and tried to start a payjoin session where there were already existing payjoins. Would this cause an overlap or an error?

While we generally reference the session Id when creating a new payjoin session incrementing does cause a problem when both sender and receiver are treated separately such that this is what the history looks like.

Session ID   Sender/Receiver           Completed At    Status         
1            Sender                    Not Completed   Session expired at Time(Time(1780413414))
2            Sender                    1780327516      Session expired at Time(Time(1780413866))
1            Receiver                  Not Completed   Waiting for original proposal
2            Receiver                  Not Completed   Waiting for original proposal

The following command will be unable to resolve

payjoin-cli cancel 1

You will receive and error like so.

Error: Session 1 exists as both a sender and receiver session. Pass `--role sender` or `--role receiver`.

It seems like better UX to simply create random or timestamp based session ids to hold internally to better manage these individual sessions.

Activity

  1. self-assigned this
    on Jun 9, 2026
  2. added this to the payjoin-cli-1.0 milestone on Jun 9, 2026
  3. DanGould commented on Jun 11, 2026

    @DanGould
    Member

    timestamp really seems like the move here. Second precision seems sufficient for payjoin-cli, but it's got me wondering if it's sufficient as a reference for services that rely on higher frequency transactions and how we'd address id for them.

  4. benalleng commented on Jun 11, 2026

    @benalleng
    CollaboratorAuthor

    https://docs.rs/crate/uuid/1.23.3/source/src/v7.rs#17

    Time based uuid? Its already in payjoin-cli's dep tree

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions