Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not allow creating duplicate pending transactions #1046

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

rolznz
Copy link
Contributor

@rolznz rolznz commented Jan 30, 2025

We originally relied on the LNClient to not allow creating duplicate pending transactions, but there seems to be a race condition that allows the creation of two pending transactions in our transactions database. When the payment is settled, only one of the pending transactions is marked as sent, and the other is left pending, which creates issues with budgets and especially sub-wallets (the money is stuck and forever inaccessible)

@rolznz rolznz requested review from bumi and im-adithya January 30, 2025 08:41
@bumi
Copy link
Contributor

bumi commented Jan 30, 2025

is there no constraint on the DB?

A find will also not fully prevent a race condition.

@rolznz
Copy link
Contributor Author

rolznz commented Jan 30, 2025

@bumi

is there no constraint on the DB?

No. For example if you try to pay once and fail, and then pay and succeed, this will be two different entries

A find will also not fully prevent a race condition.

Here it's done within a database transaction.

@rolznz rolznz merged commit 7018918 into master Jan 31, 2025
10 checks passed
@rolznz rolznz deleted the fix/pending-duplicate-transaction branch January 31, 2025 04:09
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.

2 participants