Просмотр исходного кода

Fix ProofsTransaction::get_proof_ys_by_quote_id to use &mut self (#1468)

Changes the method signature from `&self` to `&mut self` for consistency with
all other methods in the `ProofsTransaction` trait.

Transaction traits should uniformly use `&mut self` because they operate within
a transactional context that may need to track state or hold exclusive access
to resources. The read-only `ProofsDatabase` trait correctly retains `&self`
for its version of this method.
C 1 месяц назад
Родитель
Сommit
ff190f3308

+ 2 - 2
crates/cdk-common/src/database/mint/mod.rs

@@ -232,13 +232,13 @@ pub trait ProofsTransaction {
 
     /// Get ys by quote id
     async fn get_proof_ys_by_quote_id(
-        &self,
+        &mut self,
         quote_id: &QuoteId,
     ) -> Result<Vec<PublicKey>, Self::Err>;
 
     /// Get proof ys by operation id
     async fn get_proof_ys_by_operation_id(
-        &self,
+        &mut self,
         operation_id: &uuid::Uuid,
     ) -> Result<Vec<PublicKey>, Self::Err>;
 }

+ 2 - 2
crates/cdk-sql-common/src/mint/mod.rs

@@ -300,7 +300,7 @@ where
     }
 
     async fn get_proof_ys_by_quote_id(
-        &self,
+        &mut self,
         quote_id: &QuoteId,
     ) -> Result<Vec<PublicKey>, Self::Err> {
         Ok(query(
@@ -327,7 +327,7 @@ where
     }
 
     async fn get_proof_ys_by_operation_id(
-        &self,
+        &mut self,
         operation_id: &uuid::Uuid,
     ) -> Result<Vec<PublicKey>, Self::Err> {
         Ok(query(

+ 1 - 1
crates/cdk/src/mint/start_up_check.rs

@@ -244,7 +244,7 @@ impl Mint {
 
                     let mut quote_id_found = None;
                     for quote in melt_quotes {
-                        let tx = self.localstore.begin_transaction().await?;
+                        let mut tx = self.localstore.begin_transaction().await?;
                         let proof_ys = tx.get_proof_ys_by_quote_id(&quote.id).await?;
                         tx.rollback().await?;