Fixed race condition

Bug: https://github.com/cashubtc/cdk/actions/runs/15683152414/job/44190084378?pr=822#step:5:19212

Reason: a race condition between removing proofs while melting and the quote states being updated.

Solution:

1. Error on duplicate proofs
2. Read quote when updating to avoid race conditions and rollbacks

Real solution: A transaction trait in the storage layer. That is coming next
This commit is contained in:
Cesar Rodas
2025-06-16 13:59:56 -03:00
parent 86eb7b8676
commit 7146cb8934
8 changed files with 99 additions and 23 deletions

View File

@@ -22,6 +22,11 @@ pub enum Error {
/// Database Error
#[error(transparent)]
Database(Box<dyn std::error::Error + Send + Sync>),
/// Duplicate entry
#[error("Duplicate entry")]
Duplicate,
/// DHKE error
#[error(transparent)]
DHKE(#[from] crate::dhke::Error),