Parcourir la source

fix: also check UNPAID mint quotes on startup (#844)

* fix: also check UNPAID mint quotes on startup

* chore: clippy warning

---------

Co-authored-by: thesimplekid <tsk@thesimplekid.com>
gudnuf il y a 4 mois
Parent
commit
78c3a9f807
1 fichiers modifiés avec 10 ajouts et 3 suppressions
  1. 10 3
      crates/cdk/src/mint/start_up_check.rs

+ 10 - 3
crates/cdk/src/mint/start_up_check.rs

@@ -8,13 +8,20 @@ use crate::mint::{MeltQuote, MeltQuoteState, PaymentMethod};
 use crate::types::PaymentProcessorKey;
 
 impl Mint {
-    /// Check the status of all pending mint quotes in the mint db
+    /// Check the status of all pending and unpaid mint quotes in the mint db
     /// with all the lighting backends. This check that any payments
     /// received while the mint was offline are accounted for, and the wallet can mint associated ecash
     pub async fn check_pending_mint_quotes(&self) -> Result<(), Error> {
         let pending_quotes = self.get_pending_mint_quotes().await?;
-        tracing::info!("There are {} pending mint quotes.", pending_quotes.len());
-        for quote in pending_quotes.iter() {
+        let unpaid_quotes = self.get_unpaid_mint_quotes().await?;
+
+        let all_quotes = [pending_quotes, unpaid_quotes].concat();
+
+        tracing::info!(
+            "There are {} pending and unpaid mint quotes.",
+            all_quotes.len()
+        );
+        for quote in all_quotes.iter() {
             tracing::debug!("Checking status of mint quote: {}", quote.id);
             if let Err(err) = self.check_mint_quote_paid(&quote.id).await {
                 tracing::error!("Could not check status of {}, {}", quote.id, err);