Skip to content

Guard concurrent sends with exclusive DB lock and URI/RK checks#1376

Draft
Mshehu5 wants to merge 1 commit intopayjoin:masterfrom
Mshehu5:guard_send
Draft

Guard concurrent sends with exclusive DB lock and URI/RK checks#1376
Mshehu5 wants to merge 1 commit intopayjoin:masterfrom
Mshehu5:guard_send

Conversation

@Mshehu5
Copy link
Contributor

@Mshehu5 Mshehu5 commented Mar 2, 2026

This PR Closes #1032

As discussed in the issue two concurrent send commands targeting the same URI could select different coins. PRAGMA locking_mode = EXCLUSIVE has been set as stated to make only one process holds write access at a time.

And also check to make sure URI and recceiver pubkey which are in use for another session is not reused

Co-authored by claude sonnet 4.6

Pull Request Checklist

Please confirm the following before requesting review:

Two concurrent send commands targeting the same URI could select different coins. Set PRAGMA locking_mode = EXCLUSIVE so only one process holds write access at a time.

Check uniqueness of URI and recceiver pubkey with duplicate checks
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 22582242969

Details

  • 63 of 70 (90.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 82.526%

Changes Missing Coverage Covered Lines Changed/Added Lines %
payjoin-cli/src/app/v2/mod.rs 0 1 0.0%
payjoin-cli/src/db/v2.rs 60 61 98.36%
payjoin-cli/src/db/error.rs 0 5 0.0%
Totals Coverage Status
Change from base Build 22579575348: 0.04%
Covered Lines: 10683
Relevant Lines: 12945

💛 - Coveralls

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

payjoin-cli should be more concurrent safe and avoid accidental double playments

2 participants