Split the database trait into read and transactions. (#826)

* Split the database trait into read and transactions.

The transaction traits will encapsulate all database changes and also expect
READ-and-lock operations to read and lock records from the database for
exclusive access, thereby avoiding race conditions.

The Transaction trait expects a `rollback` operation on Drop unless the
transaction has been committed.

* fix: melt quote duplicate error

This change stops a second melt quote from being created
if there is an existing valid melt quote for an invoice already.
If the first melt quote has expired then we allow for a new melt quote to be created.

---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
This commit is contained in:
C
2025-06-28 08:07:47 -03:00
committed by GitHub
parent 3f84b3b4c8
commit 238b09d56a
28 changed files with 1483 additions and 1088 deletions

View File

@@ -26,7 +26,7 @@ pub async fn check_pending(multi_mint_wallet: &MultiMintWallet) -> Result<()> {
// Try to reclaim any proofs that are no longer pending
match wallet.reclaim_unspent(pending_proofs).await {
Ok(()) => println!("Successfully reclaimed pending proofs"),
Err(e) => println!("Error reclaimed pending proofs: {}", e),
Err(e) => println!("Error reclaimed pending proofs: {e}"),
}
}
Ok(())