Read the latest mint quote status in a transaction to avoid race conditions #1166

Merged
crodas merged 3 commits from fix/duplicate-entry-on-mint into main 2025-10-08 20:52:40 +00:00
crodas commented 2025-10-08 00:08:08 +00:00 (Migrated from github.com)

Description

Fixes #1162


Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

### Description Fixes #1162 ----- ### Notes to the reviewers <!-- In this section you can include notes directed to the reviewers, like explaining why some parts of the PR were done in a specific way --> ----- ### Suggested [CHANGELOG](https://github.com/cashubtc/cdk/blob/main/CHANGELOG.md) Updates <!-- Please do not edit the actual changelog but note what you changed here. --> #### CHANGED #### ADDED #### REMOVED #### FIXED ---- ### Checklist * [x] I followed the [code style guidelines](https://github.com/cashubtc/cdk/blob/main/CODE_STYLE.md) * [x] I ran `just final-check` before committing
thesimplekid (Migrated from github.com) reviewed 2025-10-08 08:31:09 +00:00
@ -45,6 +45,20 @@ impl Mint {
thesimplekid (Migrated from github.com) commented 2025-10-08 08:31:05 +00:00

I think we should do this for all payment methods? The same race condition could occur.

I think we should do this for all payment methods? The same race condition could occur.
crodas (Migrated from github.com) reviewed 2025-10-08 10:02:16 +00:00
@ -45,6 +45,20 @@ impl Mint {
crodas (Migrated from github.com) commented 2025-10-08 10:02:16 +00:00

Yes, done in a93b8c9d

Yes, done in a93b8c9d
thesimplekid (Migrated from github.com) requested changes 2025-10-08 11:48:44 +00:00
@ -48,0 +57,4 @@
&& (current_state == MintQuoteState::Issued || current_state == MintQuoteState::Paid)
{
return Ok(());
}
thesimplekid (Migrated from github.com) commented 2025-10-08 11:48:39 +00:00

This needs to be only bolt11 though, since bolt12 can be paid multiple time.

This needs to be only bolt11 though, since bolt12 can be paid multiple time.
crodas (Migrated from github.com) reviewed 2025-10-08 11:58:38 +00:00
@ -48,0 +57,4 @@
&& (current_state == MintQuoteState::Issued || current_state == MintQuoteState::Paid)
{
return Ok(());
}
crodas (Migrated from github.com) commented 2025-10-08 11:58:38 +00:00

You are right, I forgot to move that statement here while removing it from the parent check. Fixed in 7b640116

You are right, I forgot to move that statement here while removing it from the parent check. Fixed in 7b640116
thesimplekid (Migrated from github.com) approved these changes 2025-10-08 20:52:30 +00:00
github-actions[bot] commented 2025-10-27 23:13:07 +00:00 (Migrated from github.com)

Backport branch created but failed to create PR.
Request to create PR rejected with status 403.

(see action log for full response)

Backport branch created but failed to create PR. Request to create PR rejected with status 403. (see action log for full response)
github-actions[bot] commented 2025-10-27 23:22:46 +00:00 (Migrated from github.com)

Successfully created backport PR for v0.13.x:

Successfully created backport PR for `v0.13.x`: - #1223
github-actions[bot] commented 2025-10-28 12:58:02 +00:00 (Migrated from github.com)

Successfully created backport PR for v0.13.x:

Successfully created backport PR for `v0.13.x`: - #1227
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cashubtc/cdk!1166
No description provided.